Repository navigation
fix(javascript): preserve ESM path intent and artifact confinement - #2700
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The reviewed changes appear safe to merge, with no blocking code issue found. SummaryThe remaining changes reject artifact-root escape before URL parsing and preserve package-map source details when a selected target cannot be looked up.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Legacy ESM subpath] --> B[Preprocess URL text and remove suffixes]
B --> C[Reject forbidden path syntax]
C --> D[Check traversal depth]
D -->|Escapes root| E[Rejected]
D -->|Stays inside root| F[Construct URL]
F --> G[Check root and directory form]
G --> H[Look up exact inventoried file]
Reviews (17) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f83944c7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bd18e7fb6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49c0023885
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 60c667b882
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec811e576f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2628578467
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cefcd2126
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3f8c65310
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The UTF-8 replacement fallback collapsed lone surrogates onto a real U+FFFD sibling identity. Structural package segments now retain exact lone UTF-16 code units as distinct WTF-8 escapes, while final target admission validates only the relative target and preserves the unavailable lookup limitation. No replacement-character path can supply the original surrogate package identity. Current source: e3f8c65. Validation: source inspection only; tests and checks were skipped at the user's explicit request. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbe29d92b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The structural WTF-8 ancestor was entering normal URI decoding after legacy traversal, so an unrepresentable base became a malformed-target rejection. The metadata URL owner now assigns valid request-local structural identities and retains the original path limitation separately. Legacy resolution uses the canonical artifact-root path for admission, classifies URL directory form, and reports unavailable before any lookup of the unrepresentable base. Removed the separate encodedAdmissionPath representation and package-relative slicing from both consumers. The existing public CLI/MCP ASAR matrix now includes parent-traversed legacy files and directory forms. Current source: cbe29d9. Validation: source inspection only; authored regressions were not executed. Tests, checks, builds and provider execution were skipped at the user's explicit request. No passing runtime or real-provider result is claimed. Directly related representation and consumer cleanup is included. The WTF-8 structural marker could be spelled by package target text, allowing an escaping entry to appear to re-enter the package root. The metadata URL owner now allocates request-local ASCII structural identities absent from both source paths and the target after URL tab/newline preprocessing. These identities are used only for admission; the original inventory path remains explicitly unavailable for lookup. Removed the old WTF-8 encoder and encodedAdmissionPath repair. Added CLI/MCP ASAR cases for both WTF-8 re-entry and tab-split placeholder re-entry with external fallback. Current source: cbe29d9. Validation: source inspection only; authored regressions were not executed. Tests, checks, builds and provider execution were skipped at the user's explicit request. No passing runtime or real-provider result is claimed. Directly related representation and consumer cleanup is included. |
|
Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open. The package metadata path can contain an unpaired UTF-16 surrogate, so its structural URL uses opaque segments. The resolver now retains the exact generated marker set and reports the representability limitation only when a marker survives URL normalization. If parent traversal removes the marker, it checks the representable candidate against the inventory and returns the resulting found or missing outcome. This is public in commit |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed7e8e3fc2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Preserve CommonJS literal paths and confined ESM URL semantics, including package main fallback, directory intent, Unicode identity, and present opaque modules. Parse extraction inputs at their AST/source owner, retain skipped HTML and source-map coverage, and distinguish endpoint candidates from proven receiver facts. Version structural fingerprints with computed literal contents and propagate them through worker contracts. Reviewed fixes include #1810, #1840, #2642, #2700, #2702, #2714, #2803, #2960, #2968, #2986, #3035, and #3036. Validation: 158 resolver tests passed; public CLI/MCP module lookup controls, package-main/Unicode workflows, and six builtin workflows passed in the current compiled lane. Worker schema/fingerprint regressions passed. Large public pdf.js completion and real Electron analysis remain unverified.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: The PR works on Node 24.18.0 and 26.11.1. Four tests that fail on main pass with it. Main still marks three escaping imports as resolved, and the PR rejects them. I tested head 3ca3697 as pushed. GitHub says it merges cleanly with main f09f454 (#3833). Main already holds the earlier rounds of this PR. Commit b58adaf names #2700. It sits inside the PR's base 44d98de. Main has none of what is left: 19 changed source lines and 74 added test lines. Results
The fixture holds outside.js at the root and an empty package at node_modules/legacy. The importer asks for six legacy paths. Main resolves all six to outside.js. Three of them climb out past the artifact root and name the private rea-artifact folder:
Head rejects those three. Its evidence says they escape the canonical artifact root. The other three still resolve. Greptile raised this case in review. The four failures on main are the two traversal tests and the two Unicode tests. The Unicode tests fail on a missing line. That line should name the selected imports target. It comes from the PR's second change. The CI log for this head shows one failing test. It is a Hopper launcher test that calls doctor, in a file this PR does not touch. Three shards were cancelled, so their results are unknown. I did not run any of these. That reading comes from the CI log and is unchecked by me. Not run
Thanks, rohitg00, for the fix and the thorough tests. Test setup
CommandsMain plus the PR: I copied the PR's two test files onto main and applied its source diff. The patch applied with an offset of 74 lines and no conflicts. Each run sat under systemd-run with a 6 GB memory cap, at nice 19. 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
Summary
Preserve legacy ESM path intent, artifact confinement, and package-map provenance during offline module resolution.
Problem and expected behavior
A request such as
legacy/feature.js/.must retain directory intent. A request such aslegacy/../../../rea-artifact/outside.jsmust be rejected before URL normalization erases its escape from the artifact root. An unavailable imports or exports target must retain the selected raw target and map kind.Unpaired UTF-16 surrogates in ASAR metadata paths must not abort analysis, collide with replacement-character siblings, or mask package-map outcomes that do not require a URL. No dedicated issue was identified for these corrections; the remaining cases were raised in review.
Change and scope
Existing upstream integrations and the bounded Apple fixture compiler timeout are retained.
Contract and boundary impact
Expected effects:
Evidence and regression coverage
Existing CLI/stdio MCP fixtures cover loader behavior, suffixes, directory forms, encoded-dot admission, package-map selection, and real ASAR Unicode identities. Added regression source covers synthetic-root escape/reentry, allowed parent traversal, empty segments, query/fragment controls, and imports/exports provenance on unavailable targets.
Source inspection establishes the affected branches and their corrected handling. The new regression cases have not been executed.
Validation performed
Merged current main (cf0a38a). The doctorHopperDiscovery CI failure came from the older base and passes after the merge. Executed on Node 24.19.0 (macOS arm64):
npm run test:focused -- tests/boundary/cli/doctorHopperDiscovery.test.ts tests/acceptance/applications/packageSpecifierSuffixCli.test.ts tests/acceptance/applications/packageUrlUnicodeCli.test.ts, 7/7 passed through CLI and stdio MCP; pre-push typecheck and lint passed. Independent run by CassieFox23 on Linux, Node 24.18.0 and 26.11.1: the PR test files pass, and 4 of them fail on main. Not run: Windows, Node 22, the full suite, real app ASARs.Compatibility, safety, and release
No public contract or dependency change. Artifact-root confinement is checked before lossy URL normalization; symlink following or target execution is not introduced. Runtime and cross-platform behavior of the latest changes remain unverified.
Author readiness
Human owner: @rohitg00
Before merge
Maintainer blocker verification
The remaining resolver changes stay within the existing offline artifact inventory: no new symlink following, outside-filesystem lookup, URL fetch, provider, execution or mutation is added. The static-scope routine-fix exception therefore applies. On the exact current head, Node 24.18.0/npm 11.16.0, packageSpecifierSuffixCli.test.ts and packageUrlUnicodeCli.test.ts passed 6/6 through CLI and stdio MCP, and check:fast passed. Coverage includes artifact-root escape/re-entry, Unicode/unrepresentable paths and explicit unavailable outcomes. No target execution was performed.