sec (8/9): replace writable-parent mount guess with explicit sandbox mounts#32
Open
jesse-merhi wants to merge 1 commit into
Open
sec (8/9): replace writable-parent mount guess with explicit sandbox mounts#32jesse-merhi wants to merge 1 commit into
jesse-merhi wants to merge 1 commit into
Conversation
…x mounts
The Docker sandbox auto-mounted the parent directory of every path-like
scanner argument as writable, so command-backed scanners had somewhere to
write result files. That handed each scanner writable host access to a
directory it never named — a footgun, worst of all for user-defined scanners.
Remove the writable-parent branch. Target args now mount read-only and
nothing target-adjacent is writable by default. Operators opt in to extra
writable mounts explicitly:
- profile `sandbox.mounts` accepts a bare path (read-only) or
`{path, write: true}` (writable);
- `--sandbox-mount <path[:rw]>` does the same on the CLI;
- both require an absolute, existing path and are recorded in sandbox metadata.
The Cisco scanner relied on the removed auto-mount to read back its result
file; it now uses its result dir as the Docker working directory (mounted
writable), matching how the AIG scanner already worked.
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: sec (8/9): replace writable-parent mount guess with explicit sandbox mounts This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
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.
What changes
Replaces the Docker sandbox's implicit writable mount with explicit,
opt-in mounts.
Before, the sandbox auto-mounted the parent directory of every path-like
scanner argument as writable, so a command-backed scanner had somewhere to
drop result files. That silently handed each scanner writable host access to a
directory it never named. Worst case: a user-defined scanner run against
.../skills/demo/SKILL.mdgot its wholedemo/folder as a writable bindmount.
Now:
sandbox.mountsor--sandbox-mount.Why it matters
The auto-mount was a guess about what a scanner needs to write, and it guessed
too broadly — granting writable access based on where the target happens to
live (a path the scanner author does not control). Making mounts explicit means
the sandbox only ever writes where an operator deliberately said it may.
New surface
Both are validated (absolute + must exist) and recorded in the run artifact's
sandbox.mounts.Reviewer-checkable proof
Validation (runnable, no Docker needed):
Core behavior (unit tests over
dockerMounts):TestDockerMountsMountsTargetReadOnlyWithoutWritableParent— an existingtarget file is mounted read-only and its parent dir is not mounted.
This is the exact property the old writable-parent branch violated.
TestDockerMountsDropsWritableParentForMissingPath— a path-like arg doesnot drag its parent in as a writable mount.
TestDockerMountsAddsExplicitMounts—{path}→ read-only bind,{path, write:true}→ writable bind.TestParseSandboxMountFlag—path,path:rw,path:write.Necessary consequence: Cisco scanner
The Cisco scanner wrote its result file into a target-arg's parent dir and read
it back on the host — it relied on the removed auto-mount. It now uses its own
result dir as the Docker working directory (which is mounted writable),
matching how the AIG scanner already worked. Covered by
TestCiscoScannerUsesResultDirAsDockerSandboxCWD. No other command-backedscanner needed the auto-mount: relyable/agentverus/snyk/socket/user-defined all
capture stdout only.
Scope
sec 8 of 9 in the user-defined-scanner hardening series; stacked on #31.
Merge order:
main → #23 → #24 → #25 … #31 → this.Finding 9 (a scanner printing its own secret into its raw JSON evidence) is
documentation-only by decision — it is the scanner author's contract, not
something ClawScan can redact without corrupting raw evidence — and is handled
separately, not as code here.
Verification