Make sandbox policy configurable with a secure default - #22
Conversation
|
Warning Review limit reached
Next review available in: 46 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: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
MxcSandbox previously ran every policy through assertHarnessPolicy,
rejecting anything that wasn't exactly the harness's opinionated shape,
so consumers could not configure the policy at all. Drop the assertion:
the policy setting is now optional, defaulting to
createHarnessPolicy({ workspace }), and any consumer-supplied
SandboxPolicy is honored as-is.
The protectedPaths guard now checks against every writable path in the
effective policy (plus the host-side workspace), not just the workspace,
so it stays honest under custom policies.
Also remove the hand-maintained sandboxPolicyVersion constant; the
default policy version is read from the installed @microsoft/mxc-sdk
package, which each SDK release accepts, so it tracks upgrades
automatically.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0136nqkeMmT6DwfMxvhUo5He
14a119a to
c01e58a
Compare
Summary
The harness previously forced its own opinionated sandbox policy: consumers could tune a few fields (
readonlyPaths,allowedHosts,timeoutMs) but could not supply a policy of their own, and the policy schema version was a hand-maintained constant. This PR keeps the secure default while making the policy fully configurable, and derives the default version from the installed SDK.Changes
HarnessSandboxSettings.policy(new, optional): pass anySandboxPolicyto replace the default. When unset, the sandbox builds the same secure default as before viacreateSandboxPolicy— writes confined to the workspace, no local network, outbound only with an explicit allowlist, no UI/clipboard/input access.createSandboxPolicyandSandboxPolicySettingsare exported from the package index so consumers can build a custom policy by spreading over the default instead of hand-writing a fullSandboxPolicy.@microsoft/mxc-sdkpackage at runtime; every SDK release accepts its own version in its supported schema range, so the default tracks SDK upgrades automatically. Aversionoverride was also added toSandboxPolicySettings.protectedPathsnow checks against every writable path in the effective policy (plus the host-side workspace, which uploads write to regardless of policy), not just the workspace — necessary now that custom policies can grant extra writable roots.Testing
npm run typecheck— cleannpm test— 84 tests across 15 files pass, including new tests for the default policy fallback, consumer-configured policies,protectedPathsagainst extra writable roots, and the SDK-derived version default.🤖 Generated with Claude Code
https://claude.ai/code/session_0136nqkeMmT6DwfMxvhUo5He