Skip to content

test: pin the trusted_exec_path contract in the policy crate - #32

Merged
VarunGore36 merged 1 commit into
mainfrom
test/policy-trusted-exec-path
Nov 8, 2026
Merged

VarunGore36 merged 1 commit into
mainfrom
test/policy-trusted-exec-path

Conversation

@VarunGore36

Copy link
Copy Markdown
Owner

Summary

Part 10 of 12 in the exec-resolution fix series.

policy::trusted_exec_path treats a bare argv[0] as trusted because the backend resolves bare names only from the sandbox's fixed PATH (GUEST_PATH — a system-tree set the guest cannot write). That reasoning was implicit; these tests pin it from the policy side so a change on either side of the contract fails CI:

  • bare names and the read-only system tree (/bin, /usr, /sbin, /lib64) → trusted
  • relative forms, .. traversal (even inside an absolute path), guest-writable locations (/workspace, /tmp, /home), and lookalike prefixes (/usrfoo/) → refused

Test plan

  • cargo test -p toolcage-policy --lib: 12 passed (5 new)
  • cargo test --workspace: 51 suites, 0 failed
  • fmt + clippy -D warnings: clean

trusted_exec_path treats a bare argv[0] as trusted because the backend
resolves bare names only from the sandbox's fixed PATH (a system-tree
set the guest cannot write). That reasoning was implicit; these tests
pin it from the policy side — bare names and the read-only system tree
are trusted, relative/traversal forms and guest-writable locations and
lookalike prefixes are refused — so a change on either side of the
contract fails CI.
@VarunGore36
VarunGore36 merged commit f7de8a0 into main Nov 8, 2026
5 checks passed
@VarunGore36
VarunGore36 deleted the test/policy-trusted-exec-path branch November 8, 2026 22:25
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