feat(sandbox): forward just-bash SandboxOptions through justbash(), enable python/js-exec#607
Open
arimxyer wants to merge 1 commit into
Open
Conversation
Contributor
|
@arimxyer is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…nable python/js-exec Surface just-bash's `SandboxOptions` on `JustBashSandboxCreateOptions` and forward them into the `Sandbox.create(...)` the backend builds: - Execution controls the backend previously hardcoded or omitted: `timeoutMs`, `maxCallDepth`, `maxCommandCount`, `maxLoopIterations`, `defenseInDepth`. - Bundled-interpreter flags `python` (stdlib-only CPython via WASM) and `javascript` (js-exec via QuickJS), both off by default. These only reach the interpreter through `Sandbox.create` as of just-bash 3.1.0 (vercel-labs/just-bash#284), so the peer floor is raised to `^3.1.0`; on older just-bash they silently no-op. Closes vercel#431. The remaining just-bash capability flags (`commands`, `customCommands`, `fetch`) are intentionally not surfaced: their just-bash types cannot be honestly restated as primitives, and exposing them would put just-bash's types on eve's public API (the same reason `defenseInDepth` is a plain boolean here). Each field is optional and falls back to just-bash's own default when omitted, so existing apps are unaffected. just-bash is added to `minimumReleaseAgeExclude` so the 3.1.0 bump resolves without waiting out the 2-day supply-chain quarantine. Tests: mock-based forwarding assertions extend to `python`/`javascript`; a real scenario test proves `justbash({ python: true })` runs `python3` (exit 0) while it is command-not-found (exit 127) by default. Signed-off-by: Ari Mayer <ari111097@gmail.com>
55b5dca to
7001c17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Forward just-bash's
SandboxOptionsthrough thejustbash()backend (viaJustBashSandboxCreateOptions→Sandbox.create(...)), and enable its bundled interpreters:timeoutMs,maxCallDepth,maxCommandCount,maxLoopIterations,defenseInDepth.python(stdlib-only CPython via WebAssembly) andjavascript(js-exec via QuickJS), both off by default.justbash({ python: true })now runspython3inside the sandbox. Closes #431.Why
justbash()built its interpreter withSandbox.create({ cwd, env, fs, network })and exposed onlyautoInstall, so an author couldn't set execution limits, an overall timeout, defense-in-depth, or — the driver behind #431 — enablepython3/ js-exec. The capability flags live on just-bash'sBashOptions, and just-bash'sSandbox.create(the call eve uses) didn't forward them; that upstream gap was fixed in vercel-labs/just-bash#284, shipped in just-bash 3.1.0.Requires
just-bash@^3.1.0(peer floor raised from^3.0.0)This is load-bearing, not housekeeping:
python/javascriptonly reach the interpreter throughSandbox.createas of 3.1.0. On older just-bash they are silently dropped —python: truewould no-op rather than error — so the version floor is the only guard against that silent failure.just-bash is added to
minimumReleaseAgeExcludeso the 3.1.0 bump resolves without waiting out the 2-day quarantine (it's a first-party vercel-labs package; the lockfile change is scoped to just-bash's own subtree). Happy to drop that and let 3.1.0 age out instead if you'd prefer.Scope: why not
commands/customCommands/fetch#431 asks for python3 + js-exec, which this delivers. The other three just-bash capability flags are intentionally not surfaced: their just-bash types (
CommandName[],CustomCommand,SecureFetch) can't be honestly restated as primitives, and exposing them would put just-bash's types on eve's public API — the same reasondefenseInDepthis narrowed to a plainbooleanhere. They can follow later if there's demand.Backward compatibility
No behavior change when the new fields are omitted — each forwards as
undefined, i.e. just-bash's existing default (network still defaults to full internet access exactly as before).Tests
just-bash-capability-options.integration.test.ts(mock): forwarding assertions extended topython/javascript, plus the default-undefinedcase.just-bash.scenario.test.ts(real just-bash): two-sided e2e for each interpreter —justbash({ python: true })runspython3 -c 'print(1 + 1)'andjustbash({ javascript: true })runsjs-exec -c 'console.log(1 + 1)', both → exit 0, stdout2; without the flag each command is not-found (exit 127).Validation
turbo run typecheck --filter=eve,oxlint, the mock integration test, and the full just-bash scenario suite (21/21) all pass locally against just-bash 3.1.0. Aminorchangeset is included.Supersedes #446
#446 forwarded only the already-supported limits/timeout fields and deferred the capability flags until just-bash#284 shipped. Now that 3.1.0 is out, this PR does the whole thing (limits + python/js-exec) off fresh
main; I'll close #446 in favor of it.🤖 Generated with Claude Code