fix(sandbox): undefine the raw fetch host bridge before user code runs - #6761
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The bootstrap now captures A new static regression test ( Reviewed by Cursor Bugbot for commit 99e4a61. Configure here. |
Greptile SummaryThe PR prevents user code from accessing the raw fetch host reference while preserving the sandboxed
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/execution/isolated-vm-worker.cjs | Captures the fetch bridge in a closure and removes its raw global binding before user code executes. |
| apps/sim/lib/execution/isolated-vm-worker-hardening.test.ts | Verifies each execution path independently hardens all currently installed raw-reference bridges, resolving the previous global-list matching issue. |
Reviews (3): Last reviewed commit: "fix(sandbox): preserve the fetch global'..." | Re-trigger Greptile
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b763250. Configure here.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 99e4a61. Configure here.
Summary
executeCodeinstalled the__fetchRefhost bridge as an isolate global but omitted it from the bootstrap'sundefined_globals, so user code ran with a live rawivm.Referencein scopefetchclosure and add__fetchRefto the hardening list, matching the patternsim/executeTaskalready useivm.Referencebridge set as an isolate global is undefined before user code runsType of Change
Testing
Drove the real worker over its IPC protocol before/after:
typeof __fetchRefgoes"object"->"undefined", whilefetch(),console, andsim.*keep working. Not exploitable on the pinnedisolated-vm6.1.2 (Reference#getdoes not traverse prototypes) - this is defense-in-depth so a version bump cannot turn it into worker-process code execution.Checklist