Skip to content

Apply env_policy and env_inject to the agent under macOS wrap - #95

Merged
ihavespoons merged 1 commit into
mainfrom
macos-wrap-env-policy
Nov 11, 2026
Merged

ihavespoons merged 1 commit into
mainfrom
macos-wrap-env-policy

Conversation

@ihavespoons

Copy link
Copy Markdown
Contributor

Part of SECENG-308, phase 3 of docs/plans/2026-10-29-macos-enforcement-gaps.md.

The macOS wrap-init reply carried no env_policy and no env_inject. The macOS client applied neither, so the agent got the caller's environment unchanged.

What changed

  • On macOS, wrap-init now sends EnvInject and EnvPolicy, as Linux does.
  • The macOS client filters the inherited environment and lays env_inject over it, in the same order as Linux.

max_bytes, max_keys and block_iteration stay out of the wrap path on every platform. pkg/types.EnvPolicyWire records why (issue #379). The plan named them, but this PR leaves that decision as it is.

Verification

  • TestPlatformSetupWrapAppliesEnvPolicyAndInject passes. It fails on the old wrap_darwin.go with all three checks.
  • go test -tags nofuse ./internal/api/ ./internal/cli/ passes. Lint reports 0 issues.
  • Build 1684, notarized and installed: scripts/test-macos-wrap-env.sh passes 2/2 with sandbox.wrap_env_policy.enabled: true. On build 1683, it failed because BASH_ENV kept the caller's value.
  • test-macos-pids-max.sh 2/2, test-macos-wrap-python.sh 3/3 and test-macos-wrap-session-reuse.sh 4/4 pass on 1684.

🤖 Generated with Claude Code

The macOS wrap-init reply carried neither env_policy nor env_inject, and
the macOS client applied neither. The agent got the caller's environment
unchanged. The reply now carries both, and the client filters the
inherited environment and lays env_inject over it, as on Linux.

max_bytes, max_keys and block_iteration stay out of the wrap path on
every platform, as pkg/types.EnvPolicyWire records (issue #379).

scripts/test-macos-wrap-env.sh is the hardware test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ihavespoons
ihavespoons merged commit 230ac96 into main Nov 11, 2026
8 checks passed
@ihavespoons
ihavespoons deleted the macos-wrap-env-policy branch November 11, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant