Repository navigation
feat: enforce the /sandbox toggle with bwrap and sandbox-exec - #45
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Comment |
|
The following comment was made by an LLM, it may be inaccurate: |
Issue for this PR
Closes #44
Type of change
What does this PR do?
The TUI's
/sandboxtoggle setsmetadata.sandbox: trueon the session and shows a badge, but no execution path ever read the flag — commands still ran with full host authority. This adds the backend.packages/core/src/sandbox.tswraps a shell command in a filesystem sandbox:sandbox-execwith an inline seatbelt profile —(allow default)+(deny file-write*)+(allow file-write* (subpath ...))for the worktree, temp locations, and/dev.Both spawn paths consult the flag by reading the session row's
metadataJSON column (v1 and v2 sessions shareSessionTable): the corebashtool swaps itsChildProcessfor the wrapped argv, and the v1shelltool passes awrappedcommand into its runner. Scope is filesystem isolation only — network and process authority are unchanged, and the permission/approval flow is untouched.How did you verify your code works?
touch /etc/blockedinside the wrapper fails withRead-only file system, worktree writes succeed,/procworks. Also discovered--unshare-pidbreaks under nested containers, hence the comment above.bun test ./test/sandbox.test.ts ./test/tool-bash.test.tsfrompackages/core/— 16 pass, including a new integration test that inserts a session withmetadata.sandbox: trueand asserts the wrapped argv (with bwrap installed) or the fail-closed error (without).bun test ./test/tool/shell.test.tsfrompackages/opencode/— 23 pass.tsgo --noEmitclean in both packages.Screenshots / recordings
Not a UI change (the
/sandboxUI already exists).Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.