Skip to content

fix(node-sea): bound duplicate blob verification work - #11066

Closed
ShuaixinHuang wants to merge 1 commit into
morluto:mainfrom
ShuaixinHuang:fix/node-sea-verification-budget
Closed

ShuaixinHuang wants to merge 1 commit into
morluto:mainfrom
ShuaixinHuang:fix/node-sea-verification-budget

Conversation

@ShuaixinHuang

Copy link
Copy Markdown
Contributor

Summary

Bound Node SEA duplicate-blob verification before hashing native payloads. A crafted Mach-O with eight overlapping section declarations makes a 17,135-byte file trigger 131,072 bytes of payload hashing and return a candidate location on main. Increasing the declaration count multiplies this work even when each blob satisfies the selected per-blob limit.

The shared collapseRanges owner serves Mach-O, ELF and PE. It deduplicated exact ranges but had no aggregate hash-work allowance. This is distinct from merged #8031's ELF note-header scan bound; the reproduction uses Mach-O and reaches the later payload-hashing stage. The Deno sibling already enforces a carrier-size duplicate-verification allowance.

Fix and boundaries

Reject unequal-length declarations as the existing conflicting-blob format failure before reading payloads. Preflight the total bytes of distinct ranges against the carrier file size, using the existing typed fixed-capacity failure and its no-runtime-override remediation. Exact aliases are still deduplicated; ordinary disjoint identical copies remain accepted.

One producing-owner fix covers all three native carrier paths. The owning guide documents the allowance. No schema, dependency, configurable limit, target execution, process lifecycle or timeout changes. This is an ordinary resource-bound correction in an existing passive parser; a new capability/scope decision is not applicable. No separate issue is linked because this focused fix includes the reproduction and public-boundary regression.

Reproduction and checks actually run

Base: 9c86465d47e98306e1ee1f77e7fb25d1d737b1db, latest main fetched again before commit.

  • Final regression files against the exact unchanged main production owner: 3 failed / 2 passed. Overlapping declarations exceed the deterministic actual-FileHandle.read byte bound; unequal lengths unnecessarily read both payloads; the compiled public inspect-artifact CLI reaches malformed-blob failure instead of the capacity refusal. Exact-alias and disjoint-copy controls pass.
  • After the fix: 162 passed, no skips, six complete files, 29.81 s: new hash-work tests, complete Node SEA reader tests, Node SEA CLI acceptance, actual production full/compact stdio MCP tests, new CLI refusal, and complete Deno reader tests.
  • The CLI regression asserts canonical truncated / limit / capacity, fixed-allowance guidance, and unchanged source bytes. A subsequent Buffer comparison style correction passed the targeted CLI again; this is overlapping verification, not an additional distinct test count.
  • npm run check:fast: passed (35.177 s).
  • Type-aware lint on all four changed TS files: 0 errors / 10 advisory warnings, all in the existing large native-carrier parser file.
  • npm run docs:check, test discovery (3496 files exactly once), global format/Knip/metadata checks, architecture guards (2761 source files), and production reachability check passed.
  • Final diff reviewed for source authority, error precedence, zero-length/exact-alias behavior, native consumers and scope. Normal commit/pre-push hooks, diff check and post-hook input checksums passed.

Verification limits: the overlapping fixture is an authored native carrier with zero-filled candidate blobs, not a runnable postject-produced executable. It deliberately reaches verification before blob decoding. Actual Linux file I/O and compiled CLI/MCP were exercised; native Windows/macOS/Bun and real Node SEA executable production/execution were not. Byte-read counts establish the work bound; no latency or memory benchmark improvement is claimed. Full npm run check/check:pr and the complete local suite were not run: all other global static components passed, while type-aware lint was scoped to changed files on this 8 GiB host. Hosted CI remains separate.

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.

Prepared with AI assistance. @ShuaixinHuang explicitly confirmed all three initial declarations after reviewing final commit b0d8773ae10a0da7eb87fc5f5c08f41e3d39440c and the evidence/limits in this body. No previous PR's confirmation was reused.

Resubmission

Re-submitted after closing the previous PR; source branch and validated change are unchanged.

@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-15T11:26:45.196509Z
We couldn’t complete this review. Comment @codex review to try again.
b0d8773 PR opened
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

Bounds duplicate Node SEA blob verification in the shared owner used by Mach-O, ELF, and PE.

  • Node SEA inspection limits duplicate-blob checks to one carrier’s worth of bytes.

No actionable issues found. Review checks were source-based; tests were not run. Whether another PR supersedes this one could not be checked because GitHub access was unavailable.

Reviews (1) · Last reviewed commit: "fix(node-sea): bound duplicate blob veri..." · Reviewed by Greptile

@morluto morluto added area: tests Test suite and verification 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: tests Test suite and verification bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants