Skip to content

fix(security): Filesystem grants derived from the inner command must not follow interpreter or symlink content that lives where the confined process can write, and each derived directory needs a bounded taint decision. - #446

Open
github-actions[bot] wants to merge 4 commits into
mainfrom
fix/security-20261031-080207-scheduled-ok-plan-03

Conversation

@github-actions

Copy link
Copy Markdown

Issue: Refs #321

What

  • Sandbox launches no longer derive filesystem read grants from the inner command without bounds: symlink chains and shebang interpreters resolved from agent-writable surface cannot extend the sandbox's read surface.
  • Newly derived read access into a home's sensitive config/credential trees is refused unless the user granted it explicitly.
  • Security regression tests cover both boundaries on the Linux and macOS backends.

Why

  • The inner command often lives where the confined process can write (workdir, temp dirs), so an unbounded derivation would let content there influence what the next sandbox may read — a security gap tracked in the linked issue.

How

  • resolveInnerBinaryDirs now takes a policy built from the grants (derivedGrantPolicyForGrants, internal/sandboxrun/resolve_binary.go) and returns every path the resolution visited; refuseDerivedGrants checks each derived directory against it and fails the launch closed when a rule is crossed.
  • Taint rule: a command, symlink hop, or interpreter on writable surface only launches when the derivation stays within already-granted paths; the error tells the user to move the tool or grant the paths explicitly.
  • Home rule: a derived directory at or below a home's sensitive trees is refused for every launch.
  • Both backends pass the policy in BuildChildArgv (internal/sandboxrun/backend_linux.go, internal/sandboxrun/backend_darwin.go).

Verification

  • go build, go vet, gofmt, and staticcheck pass.
  • The security regression tests (internal/sandboxrun/derived_grants_security_test.go plus the updated backend and resolver tests) pass.

Follow-up

  • None.

Test Writer Agent and others added 4 commits October 31, 2026 09:09
Signed-off-by: Test Writer Agent <test-writer@security-remediate.invalid>
Signed-off-by: Test Writer Agent <test-writer@security-remediate.invalid>
…not follow interpreter or symlink content that lives where the confined process can write, and each derived directory needs a bounded taint decision.

Signed-off-by: Fix Writer Agent <fix-writer@security-remediate.invalid>
…not follow interpreter or symlink content that lives where the confined process can write, and each derived directory needs a bounded taint decision.

Signed-off-by: Fix Writer Agent <fix-writer@security-remediate.invalid>
@github-actions github-actions Bot added the do-not-merge Hold: automated fix PR, needs a human pass label Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Hold: automated fix PR, needs a human pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants