fix(artifacts): keep cpio checksum evidence and bound xar TOC elements (#1082)

Record-and-continue used to catch integrity exceptions and keep only the
message, so directory, symlink, special-node, and zero-size link CRC
failures dropped the declared and observed sums. One checksum check now
returns that observation for every member kind.

A TOC within the byte cap can still contain millions of elements. Count
elements before building the DOM and fail with a tagged limit.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morluto
2026-10-08 22:41:42 +08:00
committed by GitHub
co-authored by Cursor Agent
parent 23578197cc
commit 6dda47c98c
5 changed files with 183 additions and 87 deletions
+2
View File
@@ -12,6 +12,7 @@ import {
} from "./ArtifactDecodedBudget.js";
import { artifactStreamPipeline } from "./ArtifactStreamPipeline.js";
import {
assertXarTocElements,
xarInteger as integer,
xarHeapPosition,
XarPathBudget,
@@ -486,6 +487,7 @@ export class XarArtifactReader implements ArtifactReader {
{ cause },
);
}
assertXarTocElements(xml);
} catch (cause: unknown) {
if (cause instanceof ArtifactReaderFailure) throw cause;
throw new ArtifactReaderFailure("format", "xar TOC is not zlib data", {