Repository navigation
fix: prevent session exports from writing outside workspace - #104708
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 6:51 PM ET / 22:51 UTC. Summary PR surface: Source +5, Tests +92, Docs +3. Total +100 across 9 files. Reproducibility: yes. Current main and the release base provide a high-confidence source reproduction: an authorized non-owner passes the command gate and the exporter writes a resolved caller-controlled path directly. Review metrics: none identified. 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
Maintainer decision needed
Security Review detailsBest possible solution: Adopt full session export as an owner-only privileged command, merge the verified release fix, and immediately land the patch-equivalent authorization and workspace-confinement change on current main. Do we have a high-confidence way to reproduce the issue? Yes. Current main and the release base provide a high-confidence source reproduction: an authorized non-owner passes the command gate and the exporter writes a resolved caller-controlled path directly. Is this the best way to solve the issue? Yes technically. The owner gate matches the sibling sensitive export command, and the exact fs-safe dependency contract provides the required canonical workspace boundary; only the intentional compatibility policy remains for maintainer decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 50dd2db02058. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5, Tests +92, Docs +3. Total +100 across 9 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 (4 earlier review cycles)
|
9f8045b to
ef5d837
Compare
|
Land-ready maintainer proof for
Proof gap: individual transports were not repeated because all enter the same reviewed shared command handler. No production session data or credentials were used. |
|
Merged via squash.
|
…#104708) * fix: prevent session exports outside workspace * fix: support aliased workspace export paths --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…#104708) * fix: prevent session exports outside workspace * fix: support aliased workspace export paths --------- Co-authored-by: VACInc <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Closes #102391.
What Problem This Solves
/export-sessionincludes the transcript, full system prompt, and tool schemas. In the shippedv2026.7.1release, any authorized sender could invoke it and pass an absolute or traversal path that OpenClaw wrote directly, including outside the workspace.This PR now targets
mainand fixes both boundaries:/export-sessionor/export;Why This Change Was Made
The sibling
/export-trajectorycommand already treats complete conversation exports as owner-only. The same owner gate is the right authorization boundary here, while independent filesystem confinement protects future callers too.The port also moves the write policy into one focused module instead of leaving security-sensitive path behavior inside HTML generation. It uses the pinned
@openclaw/fs-safeRootcontract for canonical containment, symlink/path-alias rejection, private0600files, and atomic writes.User Impact
Evidence
Current shipped reproduction:
v2026.7.1was published on 2026-07-13.[email protected]is the current npm version.isAuthorizedSender, then passes a caller-controlled resolved path tomkdirandwriteFilewithout a workspace boundary.Current-main port:
f703c7109e8ab1b6f3a75015cf7220458837bbaa.check:changedgate in a fresh, public-network, no-hydrate AWS Crabbox lease (run_dbe022a270cf). The bootstrap verified the exact SHA and rejected IMDS credentials before installing pinned Node and pnpm.origin/mainreported no accepted/actionable findings (patch is correct, confidence0.90).git diff --checkand targetedoxfmtpassed.The real fs-safe boundary now has filesystem-backed regression coverage for:
0600permissions;The contributor's original exact-head Proxmox Crabbox proof exercised synthetic owner/helper identities plus absolute, traversal, in-workspace, overwrite, collision, and symlink-parent cases on the release-targeted implementation. The final main-targeted head additionally has both the exact-head isolated AWS proof and hosted CI cohort above.
Proof Scope
The shared command handler and real filesystem implementation are covered. No production session data or credentials were used. Individual chat transports are not re-tested because they all enter the same shared command handler.