Repository navigation
Resident cycles refused on Linux: semantic.db grant trips the bwrap non-subtree .env deny check - #9151
Merged
Conversation
…ra… [ORB-24174] Resident cycles refused on Linux: semantic.db grant trips the bwrap non-subtree .env deny check Fixes: 2f9ef8d ("fix: [friction-curation] Index resident task writes instead of warning … [ORB-24077] (#9096)") Regression-From: ORB-24077 Regression: broke_existing; escape=no_test; severity=high
…r, and I repaired a hard-link alias bypass: overlapping regular-file grants with multiple links now fail closed while single-link semantic.db grants still compile; directory/subtree grants and exact `.env` grants remain refused. The new regression reproduces the alias defect and passes after repair. The policy and reviewer profile files remain unchanged. Final focused tests, formatting, Clippy, rustdoc and ci-guards pass; the broader sandbox target reported 93 passed, 0 failed, 3 ignored but deferred its Bubblewrap runtime paths because this host cannot create unprivileged user namespaces, so capable-Linux evidence remains outstanding. [ORB-24174] Findings: F1 Paths: crates/orbit-exec/src/linux_sandbox/rules.rs, crates/orbit-exec/tests/sandbox/linux_sandbox.rs Orbit-Review-Attempt: rvw-068a6b8dd5b2-1 Orbit-Review-Crew: luna@xhigh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task
ORB-24174 — Resident cycles refused on Linux: semantic.db grant trips the bwrap non-subtree .env deny check
Description
Since 0.49.0 every
resident_cycle_pipelinerun on dk-server-2 fails in ~2s at thecyclestep, before any provider call (jrun-20261112-0517-t1, jrun-20261112-0528-t1; last success jrun-20261111-1436-t1 on 0.48):Cause
ORB-24077 (#9096) moved the workspace lexical index grant (
<ws>/.orbit/state/semantic.dbplus-wal/-shm) out of thegrants_workspace_modifygate inappend_linux_runtime_write_roots(crates/orbit-core/src/adapter/engine_host/actions/sandbox/runtime_grants.rs), so the read-onlyreviewerprofile the resident cycle runs under now carries writable paths inside the workspace root.In
crates/orbit-exec/src/linux_sandbox/argv.rs(~L149-166) a non-subtree deny is refused for a non-managed-worktree invocation whenoverlaps_writable_root(denied, &writable_roots)(rules.rs:73) is true. The<ws>/**/.envdeny from the shipped default policy has static prefix<ws>, which now contains the semantic.db grants, so the check refuses. Before ORB-24077 the reviewer profile had no writable root under<ws>and the check never fired. The reviewer golden (tests/sandbox_profile_goldens/linux/reviewer.txt) was updated but does not exercise the direct-invocation refusal, so CI passed.Other reviewer-lane jobs (pilot, gate, PR) are unaffected on the box; only the resident cycle runs
revieweras a direct invocation from the registered checkout.Fix direction
Exact-file grants (the bind-fd sqlite grants: a fixed file whose name cannot match the deny's final glob segment) cannot be used to create or modify a
.envfile, so they should not count as overlapping writable roots for a non-subtree deny. Either exclude exact-file runtime-store grants fromwritable_rootsin the overlap check, or make the overlap test consider whether a grant could match the deny pattern. Keep the refusal for any directory/subtree grant under the deny prefix. Do not widen the reviewer profile or drop the.envdeny.Resident ORB-24171 is paused until this lands; resume it afterwards.
Acceptance Criteria
reviewerfs profile under the shipped default policy, as a direct invocation (managed_worktree false) from the registered checkout, succeeds with the<ws>/.orbit/state/semantic.db*grants present**/.envdeny<ws>/**/.envdeny remains in the shipped default policy and the reviewer profile gains no new grantsExecution Summary
Click to expand
Fix: refined overlaps_writable_root in crates/orbit-exec/src/linux_sandbox/rules.rs — an existing regular-file writable root overlaps a non-subtree deny only when the deny glob matches that exact file (fail-closed on regex error); directory/subtree roots keep prefix-overlap refusal. semantic.db/-wal/-shm bind-fd grants therefore no longer trip **/.env, while an exact .env grant still refuses.
Criteria: (1) reviewer-style direct invocation (managed=false) with /.orbit/state/semantic.db* exact grants + shipped **/.env, /.env., **/.env, /.env. denies compiles — covered by new regression test and passed. (2) Directory/subtree grant under ws still refused with non-subtree denyModify — same test, passed; plus existing workspace/ refusal tests pass. (3) Regression test crates/orbit-exec/tests/sandbox/linux_sandbox.rs::direct_invocation_allows_exact_file_grants_but_refuses_directory_grants covers both cases plus exact-.env variant; verified it fails on unfixed code with the reported PolicyDenied message and passes after. (4) crates/orbit-core/assets/policies/default.yaml unchanged (/.env deny remains, reviewer modify:[]) — confirmed via grep and clean diff on that file; no profile widening.
Validation: cargo test -p orbit-exec --test sandbox direct_invocation_allows_exact_file (passed, also fails-before check); cargo test -p orbit-exec --test sandbox full suite 93 passed/3 ignored (bwrap namespace checks deferred by probe on this host, as existing tests report); cargo fmt --all -- --check passed; rustfmt --check on changed files passed; make ci-guards passed; scripts/build-budget.py clippy -p orbit-exec --lib --bins -D warnings passed; clippy --all-targets passed; cargo doc -p orbit-exec with RUSTDOCFLAGS=-D warnings passed. Pipeline final validation (task.final_validation_commands) recorded not_run per instructions — pipeline runs it.
Reconciliation: only crates/orbit-exec/src/linux_sandbox/rules.rs and crates/orbit-exec/tests/sandbox/linux_sandbox.rs changed vs baseline aaf2bfb (clean baseline); context_files widened to include the test file; .orbit/tmp/rules.rs.bak scratch left in gitignored tmp only. Note: resident ORB-24171 resume is pipeline/operator action after landing, not done here.
Validation
Branch Freshness
origin/agent-mainorbit/ORB-24174-c2ba8b7e