fix(openshell): pin host writes to sandbox root#69797
Conversation
Greptile SummaryThis PR fixes a symlink-parent write escape in Confidence Score: 5/5Safe to merge; the fix is minimal, correct, and backed by a focused regression test. The only remaining finding is a P2 tracking note about No files require special attention;
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f78e62eb1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
5f78e62 to
faff642
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d63d0aa76
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
02b10cb to
2dc49e7
Compare
2dc49e7 to
56cb4e3
Compare
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix (cherry picked from commit 7be82d4)
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
* fix(openshell): pin host writes to sandbox root * fix(openshell): use plugin sdk infra runtime * fix(openshell): reject symlink write targets * chore(changelog): note openshell sandbox write fix
fix(openshell): pin host writes to sandbox root
Summary
Describe the problem and fix in 2–5 bullets:
OpenShellFsBridge.writeFilevalidated a target path and then performedmkdir, temp-file creation, and rename through the unresolved host path, leaving a symlink-parent race that could escape the mounted root.writeFileWithinRoot, which uses the existing root-scoped atomic write helper, and a regression test now asserts that symlink-parent writes are rejected.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
[[audio_as_voice]]tag support #490 inNVIDIA-dev/openclaw-trackingRoot Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.fs-safepinned write helper and had no regression test covering a symlink-parent write escape.assertLocalPathSafety,mkdir, temp-file creation, and rename across separate filesystem operations.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.extensions/openshell/src/openshell-core.test.tsalias/escape.txtmust fail whenaliasis a symlinked parent path, and no file may be created outside the local mount root.OpenShellFsBridge.writeFilepath with a controlled local filesystem layout and verifies both rejection and no out-of-root write.User-visible / Behavior Changes
Writes through symlinked parent paths in the OpenShell sandbox backend now fail instead of creating files outside the mounted workspace root.
Diagram (if applicable)
Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
test/vitest/vitest.extension-misc.config.tsSteps
OpenShellFsBridge.writeFilewith a target under the symlinked parent path.Expected
Actual
pnpm exec vitest run --config test/vitest/vitest.extension-misc.config.ts openshell/src/openshell-core.test.ts --reporter=verbosepassed with1test file and10tests passing, including the new symlink-parent regression case.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
openshellunit test file passed on the currentupstream/mainbase; the existing normal write-and-sync path still passed alongside the new rejection case.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.