[GH-ISSUE #5786] Shell sandbox write-deny list only covers sensitive files that exist at spawn, so new sensitive files can be created unreviewed #3197

Closed
opened 2026-10-21 06:00:26 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Sep 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5786

Originally assigned to: @kolacheee on GitHub.

In one sentence: the shell sandbox's write-deny list is built only from sensitive paths that exist when the sandbox spawns, so a bash command can create a NEW supply-chain-sensitive file (a package.json in a fresh directory, a root Dockerfile that was absent) with no deny rule and no user review.

The gap

workspacePolicyPaths (workspace-shell-sandbox.ts) walks existing directory entries and uniqueExistingPaths filters through existsSync before the read-only binds (Linux) / deny file-write* rules (macOS) are emitted. Sensitive directories (.github/workflows, win/installer) are covered for new files inside them, but name-keyed sensitive files (package.json anywhere, root launcher files) that do not exist at spawn - including in a directory mkdir'd by the same command - get no rule, while the workspace root is mounted writable.

The heuristic refusal added for #5777 (bashCommandTargetsSensitivePath) now catches the common write shapes for both existing and new files, but it is a best-effort command-string check by design - any shape it misses creates a reviewed-class file with zero review, which is a false negative on the sensitive-file approval floor rather than just a wrong "applied" signal.

Fix directions

  • Post-execution scan: after a sandboxed command that bashLooksMutating, re-walk the workspace for sensitive-by-name files whose mtime/existence changed during the run; quarantine or surface any hit as a pending approval instead of leaving it in place.
  • Or deny-by-name at the sandbox layer where the backend allows it (harder: bind mounts and seatbelt rules are path-keyed, not name-keyed - would need an allowlisted overlay/tmpfs approach for the workspace root).
  • Or both: the scan is the safety net, the heuristic stays the fast path.

Found during the adversarial review for the #5776-#5778 fixes; pre-existing, and the #5777 doc comment was corrected there to stop calling the sandbox a hard floor for this case.

Originally created by @kolacheee on GitHub (Sep 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5786 Originally assigned to: @kolacheee on GitHub. **In one sentence:** the shell sandbox's write-deny list is built only from sensitive paths that exist when the sandbox spawns, so a bash command can create a NEW supply-chain-sensitive file (a `package.json` in a fresh directory, a root `Dockerfile` that was absent) with no deny rule and no user review. ## The gap `workspacePolicyPaths` (workspace-shell-sandbox.ts) walks existing directory entries and `uniqueExistingPaths` filters through `existsSync` before the read-only binds (Linux) / `deny file-write*` rules (macOS) are emitted. Sensitive *directories* (`.github/workflows`, `win/installer`) are covered for new files inside them, but name-keyed sensitive *files* (`package.json` anywhere, root launcher files) that do not exist at spawn - including in a directory `mkdir`'d by the same command - get no rule, while the workspace root is mounted writable. The heuristic refusal added for #5777 (`bashCommandTargetsSensitivePath`) now catches the common write shapes for both existing and new files, but it is a best-effort command-string check by design - any shape it misses creates a reviewed-class file with zero review, which is a false negative on the sensitive-file approval floor rather than just a wrong "applied" signal. ## Fix directions - Post-execution scan: after a sandboxed command that `bashLooksMutating`, re-walk the workspace for sensitive-by-name files whose mtime/existence changed during the run; quarantine or surface any hit as a pending approval instead of leaving it in place. - Or deny-by-name at the sandbox layer where the backend allows it (harder: bind mounts and seatbelt rules are path-keyed, not name-keyed - would need an allowlisted overlay/tmpfs approach for the workspace root). - Or both: the scan is the safety net, the heuristic stays the fast path. Found during the adversarial review for the #5776-#5778 fixes; pre-existing, and the #5777 doc comment was corrected there to stop calling the sandbox a hard floor for this case.
bsakaguchi 2026-10-21 06:00:26 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3197
No description provided.