Repository navigation
Enforce pids_max in macOS sessions, and warn on limits macOS ignores - #94
Merged
Merged
Conversation
The snapshot now carries resource_limits.pids_max. The extension denies an exec in a session that holds more processes than pids_max, and sends an execve event with rule resource-limit-pids-max. ES has no AUTH event for fork, so a plain fork still works. On macOS, `agentmon policy validate` now warns for max_memory_mb, memory_swap_max_mb, cpu_quota_percent, the disk and network rates, and the fork gap in pids_max. scripts/test-macos-pids-max.sh is the hardware test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of SECENG-308, phase 3 of
docs/plans/2026-10-29-macos-enforcement-gaps.md.macOS did not enforce any
resource_limitsfield underwrap.What changed
pids_max.pids_max. It sends anexecveevent with ruleresource-limit-pids-max. ES has no AUTH event for fork, so a plain fork still works.agentmon policy validatewarns formax_memory_mb,memory_swap_max_mb,cpu_quota_percent, the disk and network rates, and the fork gap inpids_max.The plan also named
RLIMIT_NOFILE,RLIMIT_CPUandRLIMIT_FSIZE. The policy has no field for them, so this PR does not add them.Verification
go test -tags nofuse ./internal/cli/ ./internal/platform/darwin/policysock/passes. Lint reports 0 issues.scripts/test-macos-pids-max.shpasses 2/2./bin/echoruns, is denied with 520 forked children againstpids_max: 500, and runs again after they exit.scripts/test-macos-wrap-python.sh3/3 andscripts/test-macos-wrap-session-reuse.sh4/4 pass on the same build.🤖 Generated with Claude Code