Skip to content

fix(windows): reject native addons with unusable delay-import tables - #12756

Closed
ShuaixinHuang wants to merge 2 commits into
morluto:mainfrom
ShuaixinHuang:fix/windows-native-verify-delay-iat
Closed

ShuaixinHuang wants to merge 2 commits into
morluto:mainfrom
ShuaixinHuang:fix/windows-native-verify-delay-iat

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fail the Windows native build and artifact verification when the cross-linker emits no delay-import directory or puts a delay-import address table in read-only PE data. These layouts previously passed identity verification even though the reported Debian build crashed at its first Node-API call.

Problem and expected behavior

The report records a write access violation at the delay IAT RVA on Windows Server 2025. The failing Debian 13 output had an empty delay-import data-directory entry and a read-only IAT section. The published Ubuntu build had a declared directory and writable IAT section. Report and fault evidence

Change and scope

Reuse the COFF, optional-header, and section readers to find the delay directory and check each descriptor's IAT RVA against a file-backed writable section. Run the check immediately after linking and in the artifact verification command, which also checks restored artifacts. Include the PE header readers in the Windows build cache key.

Contract and boundary impact

  • Semantic owner and earliest changed stage — Windows native artifact validation, immediately after linking.
  • Contribution scope fit — ordinary build validation within existing boundaries. No maintainer scope decision applies.
  • CLI and MCP/tool-catalog contract — the development artifact verifier now fails with a linker diagnostic for these layouts. Product CLI and MCP contracts are unchanged.
  • Platform compatibility — Windows x64 Node-API addons produced by the existing Linux cross-build lane.
  • Artifact and package impact — build-time and verifier admission checks are stricter. The manifest schema, ABI and runtime loader are unchanged.

Evidence and regression coverage

  • The process-boundary tests cover the verifier with source and from the compiled graph without installed dependencies. Each accepts a writable IAT and rejects a read-only IAT and a missing directory, even with matching manifest digests.
  • The published [email protected] addon passed locally. Clearing write permission on the containing PE section and recalculating the digest passed the identity checks but failed the new check. Clearing the directory entry also failed the new check.
  • Windows execution and a fresh MinGW build were unavailable locally. This check covers the reported PE layouts. Windows runtime coverage remains with the existing smoke lane.

Validation performed

  • node scripts/run-typescript.mjs -p tsconfig.build.json passed.
  • vitest run src/domain/windowsNativeArtifact.test.ts tests/boundary/process/windowsNativeArtifactVerifier.test.ts passed all 31 tests.
  • Formatting and git diff --check passed.

Compatibility, safety, and release

No migration or ABI change. Local builders whose toolchain emits either unusable layout now fail with a diagnostic. The verifier reads build output without loading or executing it.

Author readiness

Human owner: @ShuaixinHuang

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

The PR rejects Windows native addons with a missing delay-import directory or an IAT outside writable, file-backed PE data.

  • Windows native artifacts must have usable delay imports.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Linked or restored addon] --> B[Check PE identity]
  B --> C[Read delay-import directory]
  C --> D[Require one file-backed section]
  D --> E[Check each descriptor's IAT section]
  E --> F{Writable?}
  F -->|Yes| G[Accept artifact]
  F -->|No| H[Fail with linker diagnostic]
Loading

Reviews (2) · Last reviewed commit: "fix(windows): use shared PE readers in d..." · Reviewed by Greptile

@ShuaixinHuang
ShuaixinHuang marked this pull request as ready for review November 20, 2026 06:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T11:49:39.684891Z c2f5089 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

ShuaixinHuang commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @morluto @kaoru0822-kitauji @N0zoM1z0 @gensokyo-dev @vincentkoc,

When a maintainer has time, could you review this PR at c2f508934? The description has the rationale and validation for this change. Thanks for taking a look.

GitHub is still rejecting my attempts to open new upstream PRs. I can continue updating existing branches and addressing review feedback.

ShuaixinHuang referenced this pull request Nov 21, 2026
* test(ida): consolidate worker release and retry checks

* test(ida): point lifecycle coverage at retained cleanup checks
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants