Skip to content

fix(sandbox): prepare protected skill mount sources on first launch - #182412

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-94425
Oct 24, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-94425

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a writable shared or private sandbox workspace can start without read-only protection on its managed skill directories when those directories do not exist yet on first sandbox launch.

User Impact

Sandboxed agents with writable workspaces now get the intended read-only skill overlays from the very first launch, not only after the skill directories happen to exist.

Why This Change Was Made

Mount selection filtered out managed skill directories that were absent at preparation time, so no read-only overlay was created for them. Workspace preparation now creates the missing managed skill roots before mount selection, sharing candidate selection with the existing validator, which still owns canonical containment and leaf-symlink rejection. Creation goes through the existing filesystem guard, which rejects symlinked mutation paths and rechecks lifecycle custody before each directory is made, and files or escaping symlink parents are left untouched; read-only workspaces are unchanged.

This continues closed PR #96028 by @momothemage, adapted to the current workspace lifecycle and mount owner, and keeps that original credit. Production LOC +79/-8; tests +64/-0; docs +0/-0. No config, protocol, SDK, dependency, or allowed-path policy change.

Evidence

  • Red on main: both new writable and private first-launch regressions in src/agents/sandbox.resolveSandboxContext.test.ts failed before the fix; both pass after it (2 passed).
  • Green: sandbox.resolveSandboxContext, sandbox/workspace-mounts, and sandbox/context.state-owner suites passed 43 tests with 2 platform skips, covering real filesystem write rejection on selected read-only mounts, ordinary writable workspace behavior, symlink and non-directory parents, bind selection, and released state-owner custody.
  • Targeted typecheck, oxlint, oxfmt, and git diff --check passed.
  • Independent review: clean, no actionable findings.
  • Gap: no native first-launch Docker or Podman run and no Linux or Windows execution; local proof stops at the mount and filesystem owner boundary, so PR CI and security-owner review remain necessary.

Fixes #94425

Materialize the existing managed skill roots at workspace preparation before
mount selection, retaining canonical containment, filesystem mutation guards,
and current workspace custody. Continue the original first-launch repair
from PR #96028 on the current sandbox lifecycle.

Co-authored-by: momothemage <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T08:18:59.838199Z e8d35e4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: e8d35e47e902ddc91fab28938beb44b0004d1b7d
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/context.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/workspace-mounts.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docker Docker and sandbox tooling agents Agent runtime and tooling size: S labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR creates missing managed skill directories before selecting read-only sandbox mounts.

Example: A new writable sandbox starts with no host skills or .agents/skills directories.

  • Before: The missing sources are omitted, allowing writes under /workspace/skills.
  • After: Preparation creates the directories so mount selection includes read-only skill overlays.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused implementation has no identified code defect, but security-boundary and upgrade evidence is incomplete.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A newly started writable sandbox can modify skill paths because their absent host directories receive no read-only overlays.
Reason: The maintainer-authored direction addresses a concrete protection gap, preserves ordinary workspace writes, and reuses existing preparation and mount owners.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open: this maintainer-authored PR addresses the linked first-launch protection gap through the existing workspace and mount owners; no discrete introduced code defect was found.

Priority: P1
Reviewed head: e8d35e47e902ddc91fab28938beb44b0004d1b7d

Before merge

  • Add real behavior proof - Authority-chain proof required: supplied tests exercise real directory preparation and mount selection with mocked surrounding services, but do not show a newly launched Docker or Podman sandbox rejecting protected-path writes while allowing ordinary writes, or released/reassigned custody preventing the new mkdir effects; provide redacted terminal output or logs without credentials or private endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - No concrete introduced bypass was found, but final-effect authority evidence remains incomplete.
  • Resolve merge risk - The PR owner must establish that released or reassigned workspace custody prevents the newly introduced host-directory mutations before filesystem I/O.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply first-launch container write-rejection evidence, final-effect custody-revocation evidence, and a latest-stable upgrade with retained workspace data and container recovery.
Agent review details

How this fits together

Sandbox preparation consumes the selected workspace, access mode, and lifecycle authority, then supplies protected filesystem sources to container and filesystem-bridge mount selection.

flowchart LR
  A[Selected workspace and authority] --> B[Workspace preparation]
  B --> C[Guarded skill directory creation]
  C --> D[Canonical mount selection]
  D --> E[Container mount plan]
  D --> F[Filesystem bridge policy]
  E --> G[Protected skill paths]
  F --> G
Loading

Technical review

Best possible solution:

Keep creation in workspace preparation, retain the shared validator and filesystem authority guard, and verify first-launch protection plus existing-container recovery.

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

Current main omits absent skill directories from protected mounts, matching the linked Docker reproduction; this read-only review did not execute target code.

Is this the best way to solve the issue?

The patch is a focused repair using existing owners: preparation materializes shared candidates, while mount resolution remains validation-only and retains containment checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ab705c5790a6.

Merge-risk options

Maintainer options:

  1. Prove the final filesystem effects (recommended)
    The PR owner should show allowed workspace preparation succeeding and revoked or reassigned custody rejecting directory creation before any host mutation.

Provenance checked

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete introduced bypass was found, but final-effect authority evidence remains incomplete.

Evidence

What I checked:

PR surface

Source +71, Tests +64. Total +135 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 79 8 +71
Tests 2 64 0 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 143 8 +135

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #94425
Summary: This PR implements the first-launch missing-source repair tracked by the security report and continues the closed original candidate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P1: The linked report and current source establish missing first-launch read-only protection on executable skill directories.
  • add merge-risk: 🚨 compatibility: Previously absent roots become protected mounts, which can change custom-bind selection and require recreation of retained containers.
  • add merge-risk: 🚨 security-boundary: The patch adds host filesystem mutations during preparation and changes when sandbox skill write restrictions take effect.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P1: The linked report and current source establish missing first-launch read-only protection on executable skill directories.
  • merge-risk: 🚨 security-boundary: The patch adds host filesystem mutations during preparation and changes when sandbox skill write restrictions take effect.
  • merge-risk: 🚨 compatibility: Previously absent roots become protected mounts, which can change custom-bind selection and require recreation of retained containers.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Show first-launch protected-path write rejection through the real container runtime while ordinary workspace writes succeed.
  • Prove released or reassigned workspace custody prevents the new host-directory mutations before I/O.
  • Verify a latest-stable upgrade preserves workspace contents and handles retained containers whose mount plans change.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 4:32 AM ET / 08:32 UTC.

@steipete
steipete merged commit 627bad2 into main Oct 24, 2026
144 of 145 checks passed
@steipete
steipete deleted the steipete/fix-94425 branch October 24, 2026 16:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…penclaw#182412)

Materialize the existing managed skill roots at workspace preparation before
mount selection, retaining canonical containment, filesystem mutation guards,
and current workspace custody. Continue the original first-launch repair
from PR openclaw#96028 on the current sandbox lifecycle.

Co-authored-by: momothemage <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docker Docker and sandbox tooling merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. security-sensitive-changed size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security/Bug] Sandbox 'skills' directory lacks initial read-only protection if host directory is missing upon agent creation

1 participant