fix: support Bun module accessor descriptors (fixes #386) - #443
RyanGarber wants to merge 1 commit into
Conversation
|
@RyanGarber is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
🤖 auto-maintain reviewAutomated, advisory triage for
Review panel: 🟡 medium highest severity just-bash maintainer code review: 🟢 low
General code review: 🟢 low
Adversarial security: 🟢 low
Adversarial security (second opinion): 🟢 low
Standard Bash and host portability: 🟡 medium
Posted by auto-maintain. This automated code review is advisory; a human maintainer makes the call. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The reviewed changes have no unresolved issues blocking approval.
Review effort: Lite
Findings: None
What changed in this PR
Fixes Bun compatibility by safely handling accessor descriptors for protected module methods.
Changes:
- Supports accessor-backed descriptors in main and worker protections.
- Adds regression tests for blocking and descriptor restoration.
- Adds a patch changeset.
| File | Description |
|---|---|
packages/just-bash/src/security/worker-defense-in-depth.ts |
Handles accessor-backed module methods in worker protection. |
packages/just-bash/src/security/module-accessor-descriptors.test.ts |
Tests accessor variants, blocking, and restoration. |
packages/just-bash/src/security/defense-in-depth-box.ts |
Handles accessor-backed module methods in main protection. |
.changeset/bun-module-accessors.md |
Documents the patch release. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3891c53 to
9442c46
Compare
just-bashcurrently is entirely unusable with Bun (see #386).Bun exposes
Module._resolveFilenameas an accessor descriptor. Spreading that descriptor and addingvaluecreates an invalid mixed descriptor. This means evennew Bash(...).exec("echo hello")fails when running in Bun, withDefenseInDepthBox: critical patches failed: Module._resolveFilename.This installs a valid data descriptor for accessor-backed module methods in both
DefenseInDepthBoxandWorkerDefenseInDepth. Preserves enumerability/configurability and derive writability from setter availability. Existing data descriptors, blocking proxies, installation verification, fail-closed behavior, and saved descriptors used for teardown remain intact. Nothing about the existing defense-in-depth behavior changes.Also adds a patch changeset and subprocess regression tests for getter-only and getter/setter descriptors, both module methods, main/worker blocking, and exact descriptor restoration.
Validation:
echo bunreturns exit 0 with empty stderr.lint:fix, andknippassed.pnpm test:runis not clean locally: 15,534 passed, 22 failed, 98 skipped, plus 7 runner errors. Failures include XZ tests after the optionalnode-liblzmainstall failed (node-gypunavailable), timeout-sensitive tests under load, andprocess.envdescriptor errors from the bundle/Vitest interaction. All unrelated to the changes in this PR.