Repository navigation
fix(windows): reject native addons with unusable delay-import tables - #15103
ShuaixinHuang wants to merge 11 commits into
Conversation
Codex Review Summary: ✅ CompletedThis 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 change reaches Windows native addon build and package-verification paths. The PR appears safe to merge, with a non-blocking gap in coverage for trailing IAT slots. Findings
Fix with agent prompt### Issue 1
tests/boundary/process/windowsNativeArtifactVerifier.test.ts:219-224
The new tests cover an early IAT null, but none writes a nonzero value after both tables end. A later change could remove the trailing-slot check without failing these tests. Add this mutation with a matching digest in both verifier modes, beside the existing zero-padding control.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds shared checks for Windows delay-import tables before manifest creation and artifact acceptance.
No security vulnerability was established. No builds or tests were run during this review. The supersession check could not complete because GitHub access required authentication. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Build[MinGW output] --> Check[Shared delay-import checks]
Check --> Manifest[Write manifest]
Artifact[Artifact and manifest] --> Identity[Check version, architecture and digest]
Identity --> Check
Check --> Accept[Accept for publication]
Check --> Reject[Reject unusable tables]
Reviews (1) · Last reviewed commit: "test(windows): cover delay-import verifi..." · Reviewed by Greptile |
| bytes.writeBigUInt64LE(0n, delaySlots + 8); | ||
| await writeArtifact(); | ||
| expect((await run()).stderr).toContain( | ||
| "inconsistent with its name table", | ||
| ); | ||
| bytes.writeBigUInt64LE(2n, delaySlots + 8); |
There was a problem hiding this comment.
Trailing slots lack test coverage
The new tests cover an early IAT null, but none writes a nonzero value after both tables end. A later change could remove the trailing-slot check without failing these tests. Add this mutation with a matching digest in both verifier modes, beside the existing zero-padding control.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/boundary/process/windowsNativeArtifactVerifier.test.ts
Line: 219-224
Comment:
**Trailing slots lack test coverage**
The new tests cover an early IAT null, but none writes a nonzero value after both tables end. A later change could remove the trailing-slot check without failing these tests. Add this mutation with a matching digest in both verifier modes, beside the existing zero-padding control.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Replaces #15090 at the same commit
afc4c05b6380435ec2ad6b23a19bff8873f00794. The prior PR records the review history and validation for this commit.The prior hosted run stopped in cross-compiler setup because the Ubuntu archive update timed out. The native build did not run in that job.
Replaces #15066 at the same commit
93eadb4d5fb26d97a0696d8c5a39dd31e3f59ad3. The prior PR records the review history and validation for this commit.Replaces #15011 at the same commit
96f7134e403a1f295c87686fb4e28264fb77a998. The prior PR records the review history and validation for this commit.Replaces #14993 at the same commit
96f7134e403a1f295c87686fb4e28264fb77a998. The prior PR records the review history and validation for this commit.Replaces #14959 at the same commit
96f7134e403a1f295c87686fb4e28264fb77a998. The prior PR records the review history and validation for this commit.Replaces #14869 at the same commit
96f7134e403a1f295c87686fb4e28264fb77a998. The prior PR records the review history and validation for this commit.Replaces #14712 at the same commit
96f7134e403a1f295c87686fb4e28264fb77a998. The prior PR records the review history and validation for this commit.Summary
Reject Windows native addons with unusable delay-import tables before writing their manifest or accepting the artifact for publication.
The earlier check accepted a two-import table when only its first eight-byte IAT slot was file-backed and writable. A matching digest establishes artifact identity, so malformed linker output could still pass publication checks. The shared owner now derives the complete IAT span from the import-name table (INT), validates every function slot and matching terminators, and checks descriptor termination. Read-only name tables and null sentinels remain valid, as does GNU ld's null descriptor immediately after the advertised directory size. Both the build and source/packed verifier consume this owner.
Replaces #14258 and addresses the full-table review finding. Main
0f4ec6231is merged; the effective Windows change remains six files.Evidence and validation
bda177eowner in the merged checkout made the production-verifier regression fail: it exited successfully with an unmapped second IAT slot. Source and source-free verifier regressions reject unmapped/read-only later function slots, mismatched termination and an early IAT null. Controls accept split writable mappings, read-only INTs and read-only null sentinels. Every artifact mutation receives a matching manifest digest.[email protected]addon passed read-only qualification (SHA-256801a9994a5edaef8479d63a8ffed08c52013f5c044a6a04b0a3164cd60bee9a5). An independent PE walk found 34 Node-API imports, a read-only.rdataINT and writable.didatIAT. Narrowing only.didat's raw/virtual extent from 512 to 8 bytes produced a derivative accepted by the published owner and refused by this fix. Neither artifact was executed locally.9192b0d4passed the real MinGW build, Windows capability controls, and Windows package/CLI/MCP gate. The built addon digest wasa475375514d4797e7a12c5327212cde42cc076d10b8c83c40cb02b817caf2ad2. All 12 built-test shards, source tests, static checks, build and docs also passed. That run's aggregate result was failure from a macOS CORE/dyld_info test; main's already-landed producer fix and captured-exit oracle are now merged as-is. These hosted results qualify9192b0d4, not the new merge commit.169d00b5: the focused Windows domain/loader/public verifier and Mach-O refusal-provider/CLI tests passed 92 tests in five files, with one actual-Darwin-only test skipped; the normal runtime/skill build passed. Full typecheck, lint, formatting, ordinary Knip, metadata, architecture guards and production reachability passed. The entire default typed-lint inventory passed in four disjoint same-rule batches: 8,230 files, 0 errors, retaining 6,058 warnings, with unchanged source hashes.npm run docs:checkpassed (8 README tests); discovery found all 3,914 test/spec files exactly once.npm run verify:packagepassed on Linux, including archive/install/update, CLI workflows and extracted-package MCP/Evidence.npm pack --dry-run --jsonpassed.Verification limits
Linux, Node 24.22.1/npm 11.16.0; task-local writable npm cache and
NODE_USE_ENV_PROXY=1. No actual Windows or macOS execution was repeated locally. Fresh hosted CI on169d00b5completed with failure: its MinGW prerequisite download exceeded the 120-second APT deadline (exit 124), before compilation or artifact validation; downstream Windows/native-package lanes were skipped. The actual Apple lane passed (12 curated files: 201 passed/4 skipped; all 78 macOS-gated files: 905 passed/8 skipped), as did all 12 built-test shards, source tests, portable tests, static checks, build and docs. The failed-job rerun request was rejected by the connected GitHub integration with HTTP 403 (Resource not accessible by integration); a repository account with Actions write permission must rerun the failed jobs. No fresh169d00b5Windows success is claimed. The previous monolithicnpm run checkwas stopped in typed lint at approximately 5 GiB RSS; the final static components and complete current typed inventory passed separately as described above. No single-process full-gate success is claimed.Replaces #14453 at the same commit. See the previous PR for the review history.
Author readiness
Human owner: @ShuaixinHuang
Delay table bounds follow-up
The earlier verifier inferred the checked extent from the shared terminator. The package build links one GNU delay-import library and GNU ld puts the writable IAT contributions in the dedicated
.didatoutput section. The verifier now requires the descriptor to own that full section and checks its complete extent. It also rejects nonzero IAT slots beyond the matching terminator.All three focused verifier tests passed, covering the source and packed paths. A benign, two-function import library linked with GNU dlltool and ld 2.45.90 also passed the production validator. This local check verifies the linker layout. The Windows-hosted addon build and runtime checks are pending for this revision.