Skip to content

fix(artifacts): verify opaque bytes before reusing inventory identities - #779

Closed
rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-ingestion-opaque-content-identities-20261006
Closed

rudycelekli wants to merge 1 commit into
morluto:mainfrom
rudycelekli:fix/rea-ingestion-opaque-content-identities-20261006

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Verify opaque ASAR/container and native-addon bytes before reusing their inventoried SHA/size during JavaScript reconstruction. Self-contained correctness regression; no separate issue linked.

Problem and expected behavior

Rebuilding an ASAR with changed non-JavaScript assets leaves its source text unchanged. Reconstruction previously accepted the stale container identity. Changed opaque .node bytes also bypassed verification because their text is intentionally not applicable. All projected inventory identities must describe bytes actually read.

Change and scope

Stream and compare raw root/nested ASAR and opaque native-addon SHA/size against the existing inventory. Text omission remains unchanged. Normalize native filesystem-stream aborts through the existing typed cancellation guard; unrelated native IO errors retain their code for outer IO classification.

Contract and boundary impact

  • Semantic owner and earliest changed stage: inventoried byte identities at JavaScript artifact ingestion, before reconstruction.
  • CLI and MCP/tool-catalog contract: unchanged schemas/tools; changed bytes now return an integrity failure instead of stale evidence.
  • Provider, bridge, target-format, or platform compatibility: local directory/ASAR readers and opaque addon files; readonly internal ASAR stream method added.
  • Evidence, artifact, provenance, or reconstruction contract: verifies SHA and size for previously skipped opaque bytes; unchanged archive/addon text scope retained.
  • Process execution, authorization, cleanup, or containment impact: no production addon execution or expanded authority; streams remain bounded and cancellation stays typed.
  • Generated metadata (docs/product-catalog.json), package, or installation impact: none.

Evidence and regression coverage

  • Tests added or updated: root/nested ASAR changed/added non-JS assets, same-size addon change, unchanged nested/direct archives/addon, native stream abort and deleted-container IO controls.
  • Base reproduction or other evidence: 5 failing regressions and one passing control before the fix. Actual ASAR SDK builds and actual Clang-built Node24 N-API addons with independently verified exports demonstrate three stale accepted identities before and three integrity failures after. During review, the new native root stream exposed raw ABORT_ERR; the failing cancellation regression now returns typed cancelled.
  • User-visible CLI/MCP output: reconstruction reports integrity failure for changed bytes rather than an old SHA; no output schema changes.
  • Remaining proof gaps: native macOS arm64/Node24 only; extra read pass, not a claim that all concurrent pathname/content races are eliminated. Native addons are executed only as an owned test oracle, never by production ingestion.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • Actual ASAR SDK/root/nested and compiled Node24 N-API fixture — 3 stale accepts before, 3 integrity failures after.
  • Focused filesystem content identity, existing ASAR freshness, boundary and composition reconstruction — 33 passed across 4 files.
  • Native root stream cancellation regression — failed with raw AbortError before normalization; passes with typed cancellation after. Direct unchanged ASAR and native ENOENT controls pass.
  • npm run check — 5 tasks successful, 125 existing warnings, zero errors.
  • npm run check:fast — 2 tasks successful.
  • Oxfmt and git diff --check — passed; SSH signature and DCO verified. Reused exact Node24.18.0/Vitest5.0.3/TypeScript7.0.2 without dependency edits.

Hosted full coverage tracked separately. External binary/browser provider verification is not applicable to passive local byte ingestion.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS native filesystem, ASAR SDK and owned native addon oracle only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: passive reads of caller-selected artifacts; no execution in production, new transport, or extraction authority. Additional opaque-byte read is bounded in memory.

AI assistance: implemented and independently source reviewed with Codex on behalf of @rudycelekli before publication.

Review checklist

  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@morluto

morluto commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @rudycelekli for the fix and the thorough verification — much appreciated!

@morluto morluto closed this Oct 7, 2026
@morluto morluto added bug Something isn't working area: evidence Evidence, artifacts, and reconstruction labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants