Skip to content

fix(sandbox): read tool rejects declared binds with workspace-only enabled - #130540

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-130193
Aug 27, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
zhangguiping-xydt:feat/issue-130193

Conversation

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor

Fixes #130193

What Problem This Solves

Fixes an issue where sandboxed agents using tools.fs.workspaceOnly: true could not read files from their own declared sandbox.docker.binds. The workspace guard rejected those container paths before the sandbox filesystem bridge could resolve the configured mount, so operators saw Path escapes sandbox root for files that were present and readable inside the sandbox.

Why This Change Was Made

The read guard now consumes the canonical sandbox filesystem mount table instead of maintaining a second, incomplete list of workspace and skill mounts. This keeps the guard and bridge aligned for agent workspace, protected skill, and declared bind mounts while excluding the primary workspace mount already represented by the guard root.

The change only expands read access to mounts already declared in the sandbox configuration. Write, edit, and apply-patch confinement is unchanged; no config, schema, default, container mount, or persistence format changes.

User Impact

Sandboxed agents can read operator-declared bind-mounted files while workspace-only confinement remains enabled. Read-only bind mounts remain protected from write and edit operations, and paths outside the workspace plus declared mounts remain rejected.

Evidence

Before the repair, the new production-assembly regression failed with:

Path escapes sandbox root (...): /cache/repos/example/tree-index.json

After the repair, the focused agent tool suite passes:

Test Files  1 passed (1)
     Tests  131 passed (131)

A real Docker sandbox was provisioned with workspaceOnly: true, workspaceAccess: none, and a read-only bind mounted at /cache/repos. The production sandbox resolver, filesystem bridge, and assembled read/write/edit tools observed:

{"reporterPath":"/cache/repos/example/tree-index.json","readDelivered":true,"writeRejected":true,"editRejected":true,"hostContentPreserved":true}

Impact-surface verification also passed the canonical mount resolver and workspace-root guard suites (31 tests, with one unrelated platform skip), the runtime import-cycle guard, and the full pnpm check preflight/typecheck/lint pipeline. The consumer sweep covered createCoreCodingTools, buildSandboxFsMounts, the filesystem bridge, workspace/agent/skill mount handling, and the write/edit guard siblings; only the read wrapper receives the additional canonical mounts.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 27, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 8:51 PM ET / August 27, 2026, 00:51 UTC.

ClawSweeper review

What this changes

The PR lets workspace-only sandbox read tools access explicitly declared Docker bind mounts by deriving their allowed roots from the canonical sandbox mount table.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary: current main’s workspace-only read guard omits declared Docker binds while the sandbox bridge already resolves them. The patch reuses that canonical mount table and preserves the separate write/edit guards.

Priority: P2
Reviewed head: 1c4fd46cf13006641891fc9c602308fe3ebb5d6c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused canonical-boundary repair with credible real Docker evidence; exact-head CI and merge-result refresh remain routine landing gates.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix production-boundary Docker evidence showing the declared-bind read succeeds while write/edit remain rejected; redact private paths or identifiers if further evidence is posted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix production-boundary Docker evidence showing the declared-bind read succeeds while write/edit remain rejected; redact private paths or identifiers if further evidence is posted.
Evidence reviewed 6 items Current-main defect: The read guard receives only agent-workspace mounts for read-only workspaces or protected skill mounts for writable workspaces, so a declared bind is absent when workspace access is none.
Canonical owner boundary: The sandbox mount resolver parses declared binds into bind-source entries, and the filesystem bridge snapshots that same table for path resolution.
Proposed repair: The PR excludes only the primary workspace mount and passes every other canonical mount to the read guard; write and edit wrapper construction is unchanged.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/agents/agent-tools.create-openclaw-coding-tools.test.ts

Result: FAIL (partial) — step 2 expect_output allows workspace-only reads from declared sandbox bind mounts: expected terminal output was not visible within 30 seconds: "allows workspace-only reads from declared sandbox bind mounts"

[test] starting test/vitest/vitest.agents-core.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130540-bIlfHx/target

 ✓  agents-core  src/agents/agent-tools.create-openclaw-coding-tools.test.ts (131 tests) 1532ms
     ✓ limits 'trusted one-tool completion' to the source only for verified completion delivery  446ms

 Test Files  1 passed (1)
      Tests  131 passed (131)
   Start at  00:52:25
   Duration  23.50s (transform 17.91s, setup 990ms, import 20.60s, tests 1.53s, environment 0ms)

[test] passed 1 Vitest shard in 30.18s
[test] starting test/vitest/vitest.agents-core.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130540-bIlfHx/target

 ✓  agents-core  src/agents/agent-tools.create-openclaw-coding-tools.test.ts (131 tests) 1381ms
     ✓ limits 'trusted one-tool completion' to the source only for verified completion delivery  317ms

 Test Files  1 passed (1)
      Tests  131 passed (131)
   Start at  00:52:56
   Duration  10.67s (transform 5.50s, setup 454ms, import 8.59s, tests 1.38s, environment 0ms)

[test] passed 1 Vitest shard in 17.30s

Assertions:

  • FAIL expect_output: allows workspace-only reads from declared sandbox bind mounts

How this fits together

Agent file tools apply a workspace-only guard before the sandbox filesystem bridge maps a container path to a permitted host mount. Both layers must recognize the same declared mounts while write and edit operations remain separately confined.

flowchart LR
  A[Agent read request] --> B[Workspace-only path guard]
  C[Sandbox configuration] --> D[Canonical mount table]
  D --> B
  D --> E[Filesystem bridge]
  B --> E
  E --> F[Declared host bind]
  G[Write and edit tools] --> H[Existing write confinement]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch is behind main and checks are queued, so landing should use a refreshed merge result with exact-head and merge-ref checks green.
  • Complete next step (P2) - No repair-lane work is needed: this PR already contains the bounded canonical fix and sufficient behavior proof; it needs normal refreshed CI and merge review.
Agent review details

Security

None.

PR surface

Source -19, Tests +51. Total +32 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 26 -19
Tests 1 52 1 +51
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 59 27 +32

Review metrics

Metric Value Why it matters
Production versus regression coverage production −19, tests +51 The repair removes duplicated mount-selection policy while adding a focused composition-boundary regression test.

Stored data model

Persistent data-model change detected: persistent cache schema: src/agents/agent-tools.create-openclaw-coding-tools.test.ts, serialized state: src/agents/agent-tools.create-openclaw-coding-tools.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the canonical mount-table reuse after rebasing or refreshing the merge result and confirming the focused sandbox regression and required checks on that exact result.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the canonical mount-table reuse after rebasing or refreshing the merge result and confirming the focused sandbox regression and required checks on that exact result.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main excludes declared binds from the read guard while the bridge accepts them, and the PR supplies a concrete Docker scenario with after-fix output.

Is this the best way to solve the issue?

Yes. Reusing the bridge’s canonical mount table removes the diverging read-side policy without changing configured mounts or write/edit confinement.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 42112dd86ec3.

Labels

Label changes:

  • add P2: This is a bounded regression in sandboxed file reads for operators who explicitly use declared binds with workspace-only confinement.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix production-boundary Docker evidence showing the declared-bind read succeeds while write/edit remain rejected; redact private paths or identifiers if further evidence is posted.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix production-boundary Docker evidence showing the declared-bind read succeeds while write/edit remain rejected; redact private paths or identifiers if further evidence is posted.

Label justifications:

  • P2: This is a bounded regression in sandboxed file reads for operators who explicitly use declared binds with workspace-only confinement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix production-boundary Docker evidence showing the declared-bind read succeeds while write/edit remain rejected; redact private paths or identifiers if further evidence is posted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix production-boundary Docker evidence showing the declared-bind read succeeds while write/edit remain rejected; redact private paths or identifiers if further evidence is posted.

Evidence

What I checked:

Likely related people:

  • brokemac79: Commit 3b6bcbf established related sandbox skill/readability and mount behavior. (role: sandbox mount feature contributor; confidence: medium; commits: 3b6bcbfb5045; files: src/agents/sandbox/fs-paths.ts, src/agents/sandbox/workspace-mounts.ts)
  • 陈杨俊0668000971: Commit 03d48c3 worked on bind versus protected-skill mount precedence. (role: bind-precedence contributor; confidence: medium; commits: 03d48c3b76ee; files: src/agents/sandbox/fs-paths.ts, src/agents/sandbox/workspace-mounts.ts)
  • Peter Steinberger: Commit 86e2083 is a recent current-main touch to the core coding-tools area. (role: recent core coding-tools contributor; confidence: medium; commits: 86e208310ff2; files: src/agents/core-coding-tools.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc vincentkoc self-assigned this Aug 27, 2026
@vincentkoc
vincentkoc merged commit c6fa27a into openclaw:main Aug 27, 2026
262 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sandboxed read tool rejects paths in the agent's own sandbox.docker.binds when workspaceOnly is true (guard mount table ignores binds)

2 participants