fix(security): route temp workspaces through private OpenClaw temp root (#101224)#101246
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 1:20 AM ET / 05:20 UTC. Summary PR surface: Source -5, Tests +57. Total +52 across 3 files. Reproducibility: yes. source-reproducible with high confidence. Current main passes raw /tmp into a dependency that chmods its root, the linked issue includes auditd proof, and the PR body includes after-fix terminal proof showing /tmp preserved. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this narrow private-temp-root fix after exact-head checks finish, then let the linked issue close from the merged PR and treat the broader sibling PR as non-canonical. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence. Current main passes raw /tmp into a dependency that chmods its root, the linked issue includes auditd proof, and the PR body includes after-fix terminal proof showing /tmp preserved. Is this the best way to solve the issue? Yes. Reusing the existing private OpenClaw temp-root resolver is the narrowest maintainable fix; restoring /tmp after mutation or weakening temp workspace privacy would be less reliable. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5d9a2b114f75. Label changesLabel justifications:
Evidence reviewedPR surface: Source -5, Tests +57. Total +52 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (5 earlier review cycles)
|
ed7b392 to
abd5daf
Compare
abd5daf to
9a07c76
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
9a07c76 to
164d1bf
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Prepared and land-ready at exact head Work completed:
Validation:
Known proof gap: a separate maintainer sanitized-AWS attempt ( |
|
Merged via squash.
|
Closes #101224
What Problem This Solves
Fixes an issue where running
openclaw skills installoropenclaw skills updatecould change/tmppermissions from0o1777(sticky + world-writable) to0o0700(owner-only), breaking access to the shared system temp directory for other processes and services. Affects Linux hosts whereos.tmpdir()resolves to/tmp.The same bug affects ClawHub plugin (
openclaw plugins install clawhub:...) and package archive downloads via the same code path.Why This Change Was Made
The root cause is that ClawHub skill and package download flows passed
os.tmpdir()(/tmp) as the root directory to@openclaw/fs-safetemp workspaces, whoseensurePrivateDirectoryhelper callschmod(root, 0o700)to enforce private permissions. Whenrootis a shared OS directory like/tmp, this mutates system-level permissions.The fix routes all temp workspace operations through
resolvePreferredOpenClawTmpDir(), which returns the private/tmp/openclawdirectory (or a user-scoped fallback{os.tmpdir()}/openclaw-{uid}). This directory is already owned by OpenClaw and has safe0o700permissions — changing its mode does not affect other system processes.Six call sites were identified and unified:
withTempDir's default root ininstall-source-utils.ts, and 5 explicittmpDir: os.tmpdir()overrides inclawhub.tscovering ClawHub skill archive downloads, skill archive URL downloads, GitHub source archive downloads, and package archive downloads (both archive and ClawPack artifact paths). No external API changes, no new dependencies.User Impact
ClawHub skill and plugin installation no longer risk corrupting
/tmppermissions. All temporary workspace operations — ClawHub downloads, archive extraction staging, and git skill cloning — now consistently use the private OpenClaw temp root instead of raw/tmp. For most users this is invisible; for users runningauditdor sharing a system with other services,/tmpsticky-bit and world-writable permissions are preserved.Evidence
Source-reproducible audit trail: Issue reporter's
auditdlogs confirmedchmodsyscalls on/tmpfrom the same process chain (openclaw-skills).fs-safe source verification: Published
@openclaw/[email protected]ensurePrivateDirectorycallsfs.chmod(root, 0o700)on the providedrootDir.Focused regression coverage: Added
install-source-utils.chmod.test.tsthat mocks an isolated parent temp root with0o1777permissions and verifies: (1)withTempDiruses the OpenClaw private temp root, and (2) the parent directory permissions remain unchanged (0o1777) after the temp workspace completes.Test results (all pass):
real behavior proof
✓ PASS: /tmp permissions unchanged (1777) — temp workspace correctly isolated under /tmp/openclaw (700)
Terminal output
This PR is AI-assisted. Analysis, implementation, and testing were performed using opencode with human review by the author.