Repository navigation
fix(linux): allow root directory write grants - #348
Conversation
## Problem The Linux nightly launches Box as root with a writable workspace. The blanket root directory-write guard stops the agent before it runs. ## Solution Restore explicit directory-write grants for Linux root launches. This is the operator-approved startup behavior change requested for this PR. A root configuration that previously failed now starts with its declared grants. Permitted files retain the launcher's identity, including root ownership. Keep capability removal, filesystem restrictions, and special-permission checks. Update the user guide and containment guidance with this behavior and scope. No configuration, record, or protocol shape changes. ## Tests Full workspace unit, integration, and documentation tests passed on Linux ARM64. Formatting and workspace clippy passed with the seven documented repository allowances. The no-default-feature containment build passed with the same warnings as current main. The Linux x86-64 containment library check passed; runtime support was not qualified. The examples gate built the final binaries; this tree has no scripted examples. The deterministic suite passed 131 cases, with ten macOS-only exclusions and no failures or errors. Two live-script-mutation library tests passed after preparing their sibling trampoline. Existing workspace ignored tests and runtime exclusions remain documented in the PR. Independent source, documentation, and behavior review found no blocker. root_directory_grants_preserve_creation fails with the original guard and passes with its removal. It proves root creation, cleared capabilities, refused special bits, and refused direct and symlink outside access. Nine actual-root/nonroot ownership and permission checks passed without skips on the prior candidate. The unchanged root network-egress harness returned PASS/CONTAINED across 44 tool calls on AL2023 ARM64. That manual cloud run used e39544d plus the same Linux code before upstream #327 and #335. Seven targets were attempted and four were not attemptable. No cloud run was repeated after synchronization with current main.
|
Assessment: Request Changes Removing the startup guard works as described. The blocking problem is the new outside-access assertions: in CI's default environment they report the wrong result, so Checked and held
The host-side "outside file unchanged" assertions are a good invariant to keep. |
|
Assessment: Approve
Re-checked at f0abcb9
|
|
Consolidating root-output behavior on this PR at the maintainer's request. PR #329 proposed extending #300's startup restriction to built-in Shell and Python creation and renames. It is now closed without merge in favor of the model here. Under this model, an explicitly granted sandbox write and a policy-approved built-in file operation can both produce root-owned output when Box runs as root. Both paths must enforce their applicable grants, denials, and file-identity checks. Programs that later consume that output use their own authority and must treat the output as untrusted. No independent policy or reachable-path repair was identified in #329 that needs to be copied here. Its implementation, tests, and review history remain available there. This leaves one active root-output proposal for review and does not claim that the related security assessment is closed. The remaining documentation cleanup is to state the built-in route consistently with this model and distinguish any separately demonstrated defect from permitted root-owned output. |
|
Assessment: Approve
Checked at 78612af
|
Human readable section
Problem: The Linux nightly launches Box as root with a writable workspace. Box rejects that grant before the agent starts, including after #343 fixes executable-alias discovery.
Solution: Restore explicit directory-write grants for Linux root launches. Keep the existing filesystem restrictions, capability removal, and permission checks. Add a regression that proves root creation works while direct and symbolic-link access outside the grant remains refused.
Trade-off: Permitted output from a root workload can remain root-owned. The same ownership rule applies to file creation through built-in Shell and Python requests, which retain their policy and reachable-path checks. A separate program that consumes that output uses its own authority. Box bounds the sandboxed process's accesses and the operations it performs for the workload.
Root-owned output and filesystem reach. The sandbox enforces its grants. A separate program outside Box later uses its own permissions.
Editable diagram · Containment explanation
Description
This deliberately changes Linux startup behavior: a root launch with covering read and write directory grants now starts its workload. Operators who relied on the blanket startup refusal will instead get the configured writable directory. No configuration keys, record formats, or protocol versions change.
The scope follows Box protects the machine, not the box and direct grants.
root_directory_grants_preserve_creationreplaces the blanket-refusal assertion. It checks ordinary reads, writes, creation, symbolic links, private temporary storage, cleared capabilities, refused special permission bits, and refused direct/symbolic-link outside access. It also checks that new files retain root ownership. Existing-file and nonroot controls remain.The root regression failed against the original startup guard and passed with this change. The nightly harness remains unchanged. The separate nonroot harness workaround and macOS capacity fallback are outside this PR.
Codex prepared this PR and ran the reported checks under maintainer direction.
Related Issues
Related: #300, #343. #329 was withdrawn in favor of this proposal; its separate ownership-based refusal was not merged.
Observed in the requested Linux workload run at
e39544d.Type of Change
Bug fix
Testing
Diagram and documentation follow-up (
78612af)Added the editable diagram and PNG, with caption and alt text, to the Linux root-launch explanation. Moved the permitted Shell/Python root-output description out of the open-code-findings list and corrected its cross-reference. The existing policy, reachable-path, and symbolic-link controls remain documented. This does not close any separate security finding.
security-enforcement.drawioreference rendered successfully; this repository has an SVG reference, so no committed PNG comparison was available.git diff --checkpassed.f0abcb9; no additional local runtime suite was needed. The hosted CI run passed Linux and macOS unit tests, deterministic containment on both platforms, lint, packaging, the site manifest, and CI Gate. The automated review of78612afaccepted the diagram and documentation with no new findings. No unresolved review threads remain; formal maintainer approval is still required.CI fixture correction (
f0abcb9)The initial Linux CI job failed all four behavioral cases in
file_ownership_linux. The outside host file used the default temporary directory. Under/tmp, Box instead exposes writable private storage at the same spelling, so the write created a private file. The host marker stayed unchanged. Local checks had usedTMPDIR=/var/tmp, which hid this fixture defect. The automated reviewer identified the same issue.Commit
f0abcb9changes only the outside fixture toNamedTempFile::new_in("/var/tmp"). Every denial assertion and the host-file integrity check remain.Validation of that correction on Linux ARM64:
d36ce29withTMPDIR=/tmp.TMPDIR=/tmp: 678 reported passes, zero failures, ignored tests, or runtime skips.TMPDIR=/tmpandTMPDIR=/var/tmp.TMPDIR=/tmp; the nonroot controls remain covered.The hosted run for
f0abcb9passed Linux and macOS unit tests, deterministic containment, lint, packaging, the site manifest, and CI Gate. The automated review accepted the correction with no blocking findings. The addressed outdated fixture thread is resolved. Full-workspace, deterministic, macOS, and cloud campaigns were not repeated locally for that one-line test correction.Initial local validation (
d36ce29)These checks ran on Linux ARM64 at the original PR head, based on
6bd1b2f, withEXPERIMENTAL_LINUX_SUPPORT=TRUEandTMPDIR=/var/tmp. The correction results above cover the changed test fixture.cargo test --workspace --all-features --locked -- --show-outputcargo fmt --all --checkbash scripts/test-all.sh box-examplesrun.shexamples.test-integ/run.shWorkspace limits: 18 ignored entries include child helpers, manual long-running tests, external HTTPS fixtures, and existing upstream issues. Runtime exclusions were the absent credential daemon, the existing Linux alias-read assertion, and an intentionally removed cardinality probe. The two initially missing-trampoline tests were rerun successfully as reported above. Raw test compilation emitted eight warnings in unchanged vendored shell tests; the owned changes add none. Existing policy performance diagnostics still report the tracked latency target miss; their required assertions passed.
justis unavailable on this host, so validation used the template-supported Cargo commands and the exact repository lint allowances.just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsPrior candidate evidence
The following results used
e39544dplus the same Linux implementation. They precede the one-line fixture correction; the regression assertions remain unchanged. Main subsequently merged #327 and #335. The documentation conflict was resolved against current main; the cloud workload was not repeated after that synchronization.network-egresscloud case on Amazon Linux 2023 ARM64The cloud result is one manual case, not a GitHub Actions candidate run or all Linux workload cases. The frozen source archive SHA-256 was
7748ed79afcbbfa59afff5dbdcf7971baea7ced3fb2fcd5f13b71990be70bad3. Two earlier driver setup failures stopped before Box; the successful retry used the unchanged source and harness. All three temporary instances were verified terminated. Raw cloud reports remain private because they include environment and agent details.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.