fix(sandbox): keep sandbox root read-only (Fixes #2394)#2405
fix(sandbox): keep sandbox root read-only (Fixes #2394)#2405deepujain wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR hardens the top-level Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/sandbox-root-permissions.test.ts`:
- Around line 20-21: The current assertions use substring checks on the
dockerfile variable which allow false positives (e.g., matching "chown root:root
/sandbox/.openclaw"); update the expectations to assert the exact command lines
using anchors or equality: replace expect(dockerfile).toContain("chown root:root
/sandbox") and the chmod check with regex or string-equality assertions that
match the full command (for example use
expect(dockerfile).toMatch(/^RUN\s+chown\s+root:root\s+\/sandbox$/m) and
expect(dockerfile).toMatch(/^RUN\s+chmod\s+755\s+\/sandbox$/m)) so the tests
require the exact relock commands in the dockerfile variable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 69b3ad0e-f630-4cd8-b7df-22dec581ae82
📒 Files selected for processing (3)
DockerfileDockerfile.basetest/sandbox-root-permissions.test.ts
Fixes NVIDIA#2394 Signed-off-by: Deepak Jain <deepujain@gmail.com>
3c57961 to
7edb864
Compare
|
Tightened the permission regression test so it matches the exact /sandbox relock commands instead of broad substrings. Reran npm test -- test/sandbox-root-permissions.test.ts. |
Summary
The sandbox image made
/sandboxwritable by thesandboxuser, sotouch /sandbox/testfilecould succeed even though the sandbox root should stay read-only for normal agent use.This keeps
/sandboxowned by root with mode0755, while preserving writable state directories that the sandbox still needs.Changes
Dockerfile.base: stop recursively handing/sandboxto the sandbox user; keep the root directory owned by root and writable only by root.Dockerfile: re-apply the root ownership/mode in the production image for compatibility with older base images.test/sandbox-root-permissions.test.ts: add static coverage so the image recipes do not regress back to a writable/sandboxroot.Testing
npm run build:clipassednpm run typecheck:clipassednpm test -- test/sandbox-root-permissions.test.tspassednpm testwas also attempted. The full suite is not green on current main in this environment; failures are in existing installer/onboard/legacy-guard tests outside this Dockerfile permission change.Evidence it works
The new test checks that both image recipes set
/sandboxtoroot:rootand0755, and that the base image no longer recursively assigns/sandboxitself to the sandbox user.Fixes #2394
Signed-off-by: Deepak Jain deepujain@gmail.com
Summary by CodeRabbit
Chores
Tests