Repository navigation
fix(js): stop application JavaScript from aborting core through URL.parse, stack traces and import() - #341
Merged
Conversation
Application JavaScript could panic native code inside a V8 callback, which aborts the process hosting core: - URL.parse ran a subclass constructor or a brand setter between parsing and reading the serialization, so a nested parse left the op without one. It now constructs through the captured URL constructor. - Error.prepareStackTrace received call sites whose cached source positions an Array.prototype setter could poison. Stacks are now always formatted by deno_core, and the hook is ignored. - A failed dynamic import unwrapped the rejection's message. import() now always rejects. Refs #300.
oglassdev
force-pushed
the
fix/js-abort-paths
branch
from
October 12, 2026 23:52
6ca1043 to
1ec5af0
Compare
2 tasks
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.
Refs #300. Application JavaScript could make native code panic inside a V8 callback, which aborts the whole process hosting core. This closes the two paths the issue reported and a third found while auditing, all inside
chunk-js, with no fork and no dependency change. One further abort remains open and is described below.Closed
URL.parsereentrancyURL.parseis our own: it checks with the capturedURL.canParseand constructs through the capturedURL. It returns a plainURLeven when called on a subclass, as the spec says.Error.prepareStackTracecached values with an index write that an inheritedArray.prototypesetter could swallow, then unwrapped them.Error.prepareStackTraceis ignored andstackis always a string, so call-site objects never reach application code. Thrown-error text is unchanged.import()whose rejection had a non-stringmessageand no stack was unwrapped unchecked.import()always rejects withTypeError: Runtime imports are unavailable. Onlyimport(import.meta.url)resolved before.The README documents the three surface changes. The one most likely to be noticed is
Error.prepareStackTrace: libraries that expect call-site arrays from.stackno longer get them.Still open
errorAdditionalPropertyKeys(abort).deno_coresizes aVecfrom an application-supplied array when converting a thrown error, sothrow Object.assign(new Error("x"), { [Symbol.for("errorAdditionalPropertyKeys")]: new Array(4294967295) })aborts the process, from an invocation, a top-level throw, a microtask error or an unhandled rejection. Review showed this can be closed insidechunk-js, but it is a larger change than this PR: take over the exception and promise-rejection boundaries (the report-exception and unhandled-rejection hooks, plus a rawTryCatcharound invocation and module evaluation) and convert with a bounded conversion instead offrom_v8_exception. It is tracked on chunk-js: URL.parse reentrancy and stack call-site caching can abort the process #300.Object.defineProperty(e, "message", { get() { for (;;); } }); throw eoutlives the deadline, because the watchdog terminates once and conversion calls the getter again. It predates this PR and is outside this class of bug.Checks
cargo test -p chunk-js(27 passed),cargo clippy -p chunk-js --all-targets -- -D warnings,cargo fmt -p chunk-js --check, andoxfmt --checkonweb.jsand the README.🤖 Generated with Claude Code