Repository navigation
fix(containment): require exec grants for writable libraries - #261
Conversation
## Problem Linux dependency discovery could make workload-writable library bytes executable without an execution grant for that library. A read-only mount did not stop changes through another writable path. ## Solution Refuse writable dependencies without explicit execution authority. Preserve explicit Exec File and Root grants, broad tool execution, existing read restrictions, floors, denials, and source-identity checks. Document the startup refusal and compatibility cost. ## Tests The containment package passed 561 tests with all features on Amazon Linux 2023 ARM64. Twelve new integration tests cover 19 contained cases, including same-run and cross-run writes. The unchanged baseline executed the fixture libraries. Removing only the execution guard made eight regression tests fail, while four permitted-operation tests passed. Build, formatting, Clippy, and independent code review passed. No native macOS or combined-repair qualification ran. `same_run_library_writes_require_explicit_execution_permission` and `a_library_staged_by_an_earlier_launch_requires_explicit_execution_permission` pin staged-write refusals and their explicit-execution controls. `explicit_execution_grants_preserve_writable_library_loads` and `broad_execution_preserves_writable_library_loads` pin permitted loading. `an_immutable_private_library_preserves_unrelated_workspace_writes` pins immutable loading with useful workspace writes. `explicit_library_denial_still_overrides_broad_execution` pins denial precedence. The `loader_admission` unit suite pins read restrictions, floors, and identity checks.
|
Assessment: Request Changes The guard correctly closes the case of genuinely writable libraries. But it inherits the Checks that held
The real-launch integration coverage across file and directory grants, symlinks, hard links, and staged writes is thorough. |
|
Assessment: Request Changes (re-review at The new ownership, permission and same-mount exemption fixes the case where the workspace and a hard-linked system library share a mount. When they are on different mounts it still refuses, including on ostree hosts. Details are in my reply on the existing Checks that held at this head
|
Permit the existing immutable hard-link exception across ordinary local mounts when neither remaps ownership. Match retained descriptor devices to the mount records and preserve conservative refusal for nested mounts, layered or unknown filesystems, inconsistent metadata, and uncertain permissions. Existing direct-write and dependency-read checks remain. Add mount-record controls and document the supported exception. Real launches cover separate tmpfs and ordinary bind mounts, with an unchanged writable-alias refusal control.
|
Assessment: Request Changes (re-review at The cross-mount exemption now covers ext4 and tmpfs layouts, including a library and a workspace on different local filesystems. One inline finding remains: it matches records by device number, and that comparison fails on btrfs, which also undoes the btrfs same-mount case that worked at Checks that held at this head
|
Btrfs subvolumes report inode device numbers that can differ from the superblock device in mountinfo. Locate mount records by the retained statx mount IDs instead of requiring device-number equality. Preserve inode permissions, admitted root identity, ownership mapping, filesystem type, and nested-mount checks. Add Btrfs mount-record controls and correct the design guide.
|
Assessment: Approve (re-review at The only change since Checks that held at this head
|
|
Assessment: Approve (re-review at The only changes since Checks that held at this head
|
Human readable section
Problem. Linux dependency discovery could make a writable library executable without an execution grant for that library. A read-only executable mount did not protect its bytes from writes through another granted path. A permitted application could load bytes that the workload changed during the same launch or an earlier launch.
Solution. Refuse startup when a discovered dependency is writable and lacks explicit execution authority. Preserve explicit execution grants and the broader execution mode used by tools. Keep existing automatic loading for immutable libraries, including verified immutable hard links.
Trade-off. Agents with writable private libraries now need explicit execution permission for those libraries, or must remove write access. Adding a read grant does not resolve this refusal. Unknown alias permissions, remapped ownership, nested mounts, or unrecognized filesystem types can still require explicit execution permission. The change adds no library copying or new loader. Startup performance was not benchmarked.
Description
The Linux check separates a dependency's execution admission from inherited restrictions on reading its dependencies. The existing floors, explicit denials, read restrictions, and source-identity checks remain. A system-library read allowance does not exempt writable dependencies from execution authorization. Overlapping execution and write grants retain their warning and permitted behavior.
Hard links require a narrower execution check than the existing conservative read check. A retained descriptor identifies the library. The check retains restrictions for workload-owned files, group or other write bits, successful effective-credential write access, and errors other than permission denial. A read-only file owned by the workload remains restricted because its owner can change its permissions.
The immutable exception also checks the dependency and writable directory mount records. The directory must contain no nested mounts. Across different mounts, neither may remap ownership, and both must use recognized ordinary local filesystems: ext2, ext3, ext4, XFS, Btrfs, tmpfs, or ramfs. Retained descriptor mount IDs identify the source and writable-directory mount records. File device numbers are not compared with mountinfo device numbers; Btrfs subvolumes can report different values. Other filesystem types and uncertain information retain the restriction. Direct writable paths, replaceable resolution paths, and explicit writable file aliases do not use this exception. Existing derived-read restrictions remain unchanged.
The measured defect is an execution-permission bypass inside containment. The tests do not demonstrate access to ungranted host resources. The check uses current filesystem grants and does not track historical file authorship.
Related Issues
No public issue linked.
Type of Change
Bug fix
Testing
Documentation follow-up at
dc91bc40e5d37e9d8bea22e24ddfa1d3e6b3fdb5clarifies agent execution grants and the tool/server exception. Independent source and prose review, relative-link and anchor checks, andgit diff --checkpassed. Only two Markdown files changed; runtime tests were not rerun locally. Hosted checks passed for this documentation head: CI Gate and all five CodeQL language analyses. The automated assessment reported Approve with no new findings atdc91bc4. This is not human approval.Hosted Linux and macOS workspace and deterministic jobs tested merge
7832b5e682f28cadd3a5983cd2ad21a31f54ed2c, combining this head with main93a376126fab710da750c37f97ad4c63bb5705e4. Checkout logs and the merge parents establish that revision; the deterministic report itself printscommit=unknown. Linux recorded 124 passes and 9 declared skips; macOS recorded 121 passes and 12 declared skips. Both recorded all 133 cases, with zero failures or errors.Hosted limits remain: Linux workspace logs omit the alias-read assertion and the unavailable credential-daemon fixture. The write assertions ran. Native macOS bridge checks skipped because the runner lacks the macOS 27 SDK. The separate Verdict job was filtered out. Passing jobs do not establish complete coverage, release qualification, or human security acceptance.
The runtime evidence below applies to
448b0a23e15ce89e905d07cbb111b61a050550ae, except where an earlier revision is named.Validation uses Amazon Linux 2023 on ARM64 (64-bit Arm), kernel
6.12.113-138.209.amzn2023.aarch64, and Rust1.98.1.e4ca8b8baselined9a39b9. The earlier correction at132274bloaded the same library and wrote the expected workspace output.448b0a2also passed.ec09f12with a separate tmpfs workspace and with an ordinary same-device bind mount. Both configurations refused startup at132274b. The bind control used a private namespace and left the parent mount namespace unchanged. A writable alias remains refused.ec09f12and loaded the immutable library with expected workspace output on the corrected source. Each comparison used an identical configuration. The private mount namespace exited and the loop device detached; the parent namespace was unchanged.448b0a2. Run 41386594245.448b0a2. Run 41386590516.448b0a2. Its formal GitHub submission is COMMENTED. Assessment.The validated runtime source is
448b0a23e15ce89e905d07cbb111b61a050550ae; the documentation follow-up leaves that runtime source unchanged.The final manual campaign repeated the two Btrfs comparisons. Earlier manual hard-link, tmpfs, and bind-mount controls above retain their recorded earlier revisions. They were not manually rerun on
448b0a2; its standard regression suites passed.justis unavailable on this host, so its recipes ran directly. Workspace tests useEXPERIMENTAL_LINUX_SUPPORT=TRUE. Workspace Clippy uses--workspace --all-targets --all-features -- -D warnings, plus the repository allowances forclippy::too_many_arguments,clippy::only_used_in_recursion,clippy::await_holding_refcell_ref,clippy::explicit_auto_deref,clippy::chunks_exact_to_as_chunks,dead_code, andnon_snake_case.The real compatibility fixture uses directory Read permission. In the earlier manual campaign, a file-only Read grant produced the same loader mapping failure on untouched
e4ca8b8and the then-tested repair revision. That existing mount-overlap behavior remains outside this patch.The workspace run omitted the real credential-daemon fixture and the Linux alias-read assertion. These are the two omissions accepted by the repository output audit. Existing ignored tests remain separate. Ownership-remapped and nested mount rejection has unit coverage; an actual ownership-remapped mount was not exercised.
Existing platform-excluded test binaries report zero tests on Linux. Package totals do not establish execution of every conditional test body. Hosted macOS validation at
448b0a2passed. Combined-repair qualification and human security acceptance remain separate.just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsChecklist
Prepared with Codex. The recorded source review is an agent review, not human approval.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.