fix(artifacts): explain ASAR PE signed-after-packing mismatches (#14702)

* fix(artifacts): explain ASAR PE signed-after-packing mismatches

When an unpacked PE companion fails ASAR integrity only because Authenticode
was applied after packing, record a verifiable signing_explanation on the
SHA-256 contradiction and error details instead of an opaque untrusted
mismatch. Bytes stay observed-untrusted; any other mutation remains an
unexplained contradiction.

Fixes #7212

* fix(artifacts): address signed-after-packing Greptile review

Catch ParseFailureError so unreadable PKCS#7 keeps the digest explanation,
share WIN_CERTIFICATE structural walks, index signer lookups, charge optional
reads to acquisition budgets with reported skips, preserve mismatch details
through cleanup failures, and inherit the shared MCP test deadline.

* fix(pe): walk WIN_CERTIFICATE entries lazily under max_entries

Convert the certificate-table walker into a generator so inspection stops at
the entry budget without materializing every range, and reconstruction can
validate structure with constant memory.
This commit is contained in:
Beqa authored and GitHub committed 2026-11-26 10:31:54 -05:00
1 parent da129c00a3
commit 4edb2c08ee
20 files changed
+1297 -76

No files matched your search

@@ -435,9 +435,11 @@ const graphLimitations = (
]),
...context.snapshot.limitations,
...emptyInputLimitations(context),
...context.snapshot.integrity_contradictions.map(
({ logical_path: path }) =>
`Artifact integrity metadata contradicts observed bytes at ${path}; the observed bytes are untrusted.`,
...context.snapshot.integrity_contradictions.map((contradiction) =>
"signing_explanation" in contradiction &&
contradiction.signing_explanation !== undefined
? `Artifact integrity metadata contradicts observed bytes at ${contradiction.logical_path}; removing the Authenticode certificate table restores the declared SHA-256 (signed after packing), but the observed bytes remain untrusted.`
: `Artifact integrity metadata contradicts observed bytes at ${contradiction.logical_path}; the observed bytes are untrusted.`,
),
...selfReferenceOmissions(
relationshipOmissions.selfImports,