Repository navigation
feat(artifacts): inventory and extract Node.js single executable application blobs - #7000
Merged
Merged
Conversation
…ication blobs Adds a node-sea artifact reader that locates the NODE_SEA_BLOB payload in Mach-O sections, ELF notes and PE RCDATA resources, decodes the blob header, main script, optional snapshot and code cache, and named assets, and extracts their stored bytes through the existing safe output tree. The executable is never run. Resource-tree errors in a PE without a NODE_SEA_BLOB name stay with native classification; truncated, unknown or over-limit SEA declarations fail closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016y53PdpyMAp9RSW65fatHe
Contributor
[Medium impact] The PR appears safe to merge based on the reviewed changes. SummaryAdds static inventory and extraction of Node.js SEA blobs in Mach-O, ELF, and PE files.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Native executable] --> B[Locate SEA blob]
B --> C[Decode bounded blob]
C --> D[Build and check members]
D --> E[Artifact inventory]
E --> F[Extract through safe output tree]
Reviews (3) · Last reviewed commit: "fix(artifacts): make SEA metadata constr..." · Reviewed by Greptile |
Move the bounded NODE_SEA_BLOB name probe into the shared PE resource layout module so SEA admission uses the same header and section mapping as the full parser; the layout reader now accepts a header prefix with the file size. Bound SEA asset count and decoded name bytes before records are created and report resource bounds as limit failures. Offer the JavaScript next probe only for main scripts with a source suffix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016y53PdpyMAp9RSW65fatHe
3 tasks done
15 of 22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Node.js single executable application (SEA) is the
nodebinary with aNODE_SEA_BLOBinjected: the main script, an optional snapshot or code cache, and named assets. Before this changeinspect-artifactsaw such a file only as a plain Mach-O, ELF or PE executable, andextract-artifacthad nothing to extract. This adds anode-seaartifact reader so the blob is inventoried and its stored members can be extracted; the executable itself is never started. No related issue; this is a new static format in the existing artifact graph.Problem and expected behavior
An analyst who wants the shipped JavaScript of a SEA today has to find the blob and decode Node's layout by hand. Expected:
inspect-artifactreports root formatnode-seawith flags, code path and fuse observations, and lists the main script, snapshot or code cache, and each asset by name;extract-artifactwrites their stored bytes through the existing safe output tree.Change and scope
src/artifacts/nodeSea/NodeSeaLocation.tslocates the blob in Mach-O__NODE_SEA_BLOBsections, ELF notes owned byNODE_SEA_BLOB, and PE RCDATA resources namedNODE_SEA_BLOB.NodeSeaBlob.tsdecodes the Node v24 layout.NodeSeaArtifactReaderbuilds members.For ELF,
PT_NOTEsegments are authoritative, as at runtime;SHT_NOTEsections are read only when no program-header table is readable. The real postject-injected aarch64 binary below carries stale section entries that start mid-note. For PE, a bounded name probe runs before the shared resource parser, so a malformed resource tree in an ordinary PE stays a native-classification concern.Truncation, unknown flags, invalid UTF-8, duplicate asset names and conflicting blobs fail closed. Limits are in
docs/node-sea.md. Asset count and name-byte admission bound retained metadata independently of body sizes; decoding and inventory construction yield for cancellation, and member construction no longer retains a second full array. Not included: decoding V8 snapshots or code caches, or any execution. No new tool; the existing artifact contracts carry the new format. AI was used for assistance.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
src/artifacts/inventory/classify.ts) and the artifact reader registry.inspect_artifact/extract_artifactaccept the newnode-searoot format; the artifact format enum gainsnode-seaandnode-sea-entry.format_metadatakinds for the root and entries; raw flags, code path, blob location and fuse observations are retained.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): adds averify:node-seapackage script. No committed build outputs.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/artifacts/nodeSea/NodeSeaBlob.test.tsandsrc/artifacts/NodeSeaArtifactReader.test.ts(Mach-O, universal, ELF and PE carriers; flags and fuses; a staleSHT_NOTEentry beside a validPT_NOTE; a non-SEA PE with a cyclic resource tree; the large-PE admission limit; truncated, unknown and conflicting blobs),tests/acceptance/nodeSeaCli.test.ts,tests/boundary/mcp/nodeSeaMcp.test.ts. Fixtures are synthetic; no binaries are committed.inspect-artifacton a SEA reports a plain native executable andextract-artifacthas nothing to extract. Executed against a real Node 24.22.1 linux-arm64 SEA (not committed), built withnode --experimental-sea-configand postject withuseCodeCache: trueand two assets. Before thePT_NOTEchange this binary failed withNode SEA ELF note table is truncated.The extracted
app.jsandgreeting.txtare byte-identical to the build inputs (cmp).For evidence-bearing changes:
Validation performed
Review follow-up
b5a7256b7; macOS arm64, pinned Node 24.22.1 and npm 11.16.0:npm run test:focused -- src/artifacts/nodeSea/NodeSeaBlob.test.ts src/artifacts/NodeSeaArtifactReader.test.ts tests/acceptance/nodeSeaCli.test.ts tests/boundary/mcp/nodeSeaMcp.test.ts- 56 tests passed. Covers parser limits, in-flight cancellation, close during inventory construction, compiled CLI inventory/extraction, and both MCP schema profiles, including refusal of an empty-body table above the record bound.npm run check- passed (typecheck, lint, module boundaries, architecture guards).npm run docs:check- passed, including 9 README consistency tests.The author's earlier real Linux arm64 SEA inventory/extraction evidence above was not rerun for this cancellation follow-up. Real Mach-O and PE producer coverage remains unverified. No resource benchmarks were run.
Compatibility, safety, and release
node-seaonly when a valid blob is found.verify:node-sea).Author readiness
Human owner: @mvanhorn
Before merge
type(scope): outcome.Demo