Skip to content

feat(sandbox): add url to QuickJS module registry - #10378

Draft
kwburns-kong wants to merge 4 commits into
developfrom
feat/QuickJS-module-url
Draft

feat(sandbox): add url to QuickJS module registry#10378
kwburns-kong wants to merge 4 commits into
developfrom
feat/QuickJS-module-url

Conversation

@kwburns-kong

Copy link
Copy Markdown
Contributor

Milestone 7 of the QuickJS legacy-module porting plan. Adds require('url'): legacy parse()/format() (verified against node:url across protocol/opaque/non-slash-protocol forms, auth/port/query/hash splitting, the unsafe-character escaping table, parseQueryString/slashesDenoteHost, and IPv6 bracketed hosts), plus a thin re-export of the ambient URL/URLSearchParams globals (M2) — matching real Node's own require('url').URL === global.URL identity.

Two documented, intentional divergences from real Node (see PERMISSIONS.md): parse()'s IPv6 hostname convention (bracket-stripped, matching node:url rather than the WHATWG-style bracket-inclusive URL global), and no backslash-as-delimiter handling — the exact legacy behavior Node's own deprecation notice on url.parse cites as having "security implications."

Draft pending Milestone 7b security review.

Legacy parse()/format() verified against node:url (protocol/opaque/
non-slash forms, auth/port/query/hash, escaping, IPv6 hosts), plus a
thin re-export of the ambient URL/URLSearchParams globals matching
real Node's own require('url').URL === global.URL identity.
['javascript://foo/bar', false],
['javascript:alert(1)?x=1#y', false],
['ws:no-slash', false],
['ws://host/path', false],
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

✅ Circular References Report

Generated at: 2026-08-11T18:01:23.795Z
Status: ✅ NO CHANGE

Summary

Metric Base (develop) PR Change
Total Circular References 9 9 0 (0.00%)
Click to view all circular references in PR (9)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/main/prompt-bridge.ts -> insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx
Click to view all circular references in base branch (9)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/main/prompt-bridge.ts -> insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/main/window-utils.ts -> insomnia/src/main/plugin-window.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx

Analysis

No Change: This PR does not introduce or remove any circular references.


This report was generated automatically by comparing against the develop branch.

… gaps

Regression cases proving the sandboxed url module's parse() doesn't strip
leading/trailing C0-control-or-space bytes before parsing (letting a leading
control byte hide a scheme from protocol detection) and that the
unsafe-character escape table is missing a single-quote entry, both against
real node:url. Intentionally red pending the fix.
parse() only called .trim(), which doesn't cover most C0 control bytes, so
a leading control byte before a scheme (e.g. a NUL before "javascript:")
went undetected as a protocol where real node:url and every browser
recognize it, after stripping the same bytes per the WHATWG URL Standard's
input-trimming step. Also adds the missing single-quote entry to the
unsafe-character escape table, matching real node:url.
…rse()

A backslash is fully interchangeable with a forward slash in real
Node's legacy url.parse (delimiter, and a stand-in for "//" after the
protocol) — match it exactly rather than diverging, so a plugin ported
from the legacy sandbox behaves identically. The function has no
host-capability surface either way, so parity costs nothing here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants