Skip to content

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

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

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

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Nov 24, 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.

Supersedes #12756.

Resubmission of #14057.

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 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no blocking issues found.

Summary

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

  • Windows native artifacts must have usable delay-import tables.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Link[Link Windows addon] --> Check[Check delay imports]
  Check -->|Pass| Manifest[Write manifest]
  Restore[Restore or download addon] --> Identity[Check manifest and byte identity]
  Identity --> Verify[Check delay imports]
  Verify -->|Pass| Accept[Accept artifact]
  Check -->|Fail| Reject[Stop with diagnostic]
  Verify -->|Fail| Reject
Loading

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@ShuaixinHuang
ShuaixinHuang marked this pull request as ready for review November 24, 2026 02:49
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T02:49:07.430924Z
We couldn’t complete this review. Comment @codex review to try again.
c2f5089 Draft marked ready
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 26, 2026
vincentkoc added a commit that referenced this pull request Nov 30, 2026
…15216)

* fix: deepen verified coverage for PR #14258

* fix(windows): recognize GNU delay-import terminator placement

* fix(windows): validate complete delay-import address tables

* fix(windows): validate delay-load descriptor targets

* fix(windows): validate delay-import function names

* fix(windows): bound delay imports to the dedicated IAT section

* test(windows): cover delay-import verifier refusals

* test(windows): cover nonzero delay-import padding

* fix(windows): require readable delay-import descriptors

* test(windows): accept read-only delay import names

* fix(windows): validate initial delay loader state

---------

Co-authored-by: ShuaixinHuang <[email protected]>
Co-authored-by: ShuaixinHuang <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants