feat(sandbox): add util to QuickJS module registry - #10374
Open
kwburns-kong wants to merge 3 commits into
Open
Conversation
Ports node:util's format/promisify/types.is* as a pure-JS reimplementation, verified for parity against real node:util (including format's -0/bigint/symbol coercion quirks and quote-selection). util.inspect/inherits/deprecate and %o's showHidden/depth-4 behavior are explicitly out of scope — documented in PERMISSIONS.md.
✅ Circular References ReportGenerated at: 2026-08-11T14:21:39.088Z Summary
Click to view all circular references in PR (9)Click to view all circular references in base branch (9)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
…-spoofability in PERMISSIONS.md Found by the independent security review: unlike the rest of types.is*, these two use Object.prototype.toString.call (no instanceof target exists for either), so a value with a forged Symbol.toStringTag can produce a wrong boolean — a correctness gap, not a capability leak.
kwburns-kong
marked this pull request as ready for review
August 11, 2026 14:09
Removes eval() from the format() parity test's literal-value comparisons (Semgrep javascript.browser.security.eval-detected) by building the real node:util comparison value directly instead of eval'ing the same source text used for the sandboxed side. Documents and suppresses the CodeQL js/bad-code-sanitization finding on runBody's plugin-source construction — body is always a fixed literal from within this file (never external input) and is expected to contain arbitrary JS syntax, including quote/backtick characters that a generic sanitizer would corrupt.
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.
Ports
format,promisify, andtypes.is*fromnode:utilas a pure-JS reimplementation in the QuickJS plugin sandbox, per the module-porting plan's reduced-scope entry forutil.format: verified against realnode:utilacross all specifiers (%s %d %i %f %j %o %O %c %%), including the-0/bigint/symbol coercion quirks and the quote-character selection used for inspected strings.promisify: error/multi-value/Symbol.for("nodejs.util.promisify.custom")override semantics verified against realnode:util.types.is*: implemented viainstanceof(immune toSymbol.toStringTagspoofing) rather thanObject.prototype.toString.call, exceptisAsyncFunction/isGeneratorFunction(documented in PERMISSIONS.md).util.inspect/inherits/deprecateare not implemented;%ois aliased to%O's bounded-depth behavior rather than replicating real Node's showHidden/depth-4/proxy inspection.Independent security review found no capability leaks or sandbox-escape paths; one documentation gap (isAsyncFunction/isGeneratorFunction's toStringTag-spoofability wasn't noted in PERMISSIONS.md) was fixed inline.