feat(il2cpp): retain v108 header and string evidence (#9925)

* feat(il2cpp): retain v108 header and string evidence

* fix(il2cpp): preserve v108 BOMs and yield while scanning

* fix(il2cpp): preserve uncertainty in v108 layout refusals

---------

Co-authored-by: dhruvac29 <dhruvac29@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-11-11 08:42:55 -05:00
1 parent 4dedf3e865
commit be6ec3f164
4 files changed
+359

No files matched your search

+31
View File
@@ -5,6 +5,7 @@ import {
IL2CPP_BINARY_BYTES,
} from "./Il2cppBinaryFormat.js";
import { Il2cppMetadataFormatFailure } from "./Il2cppMetadataFormat.js";
import { inspectIl2cppMetadataV108 } from "./Il2cppMetadataV108.js";
import type { AnalysisPartialObservation } from "../domain/analysisErrorBase.js";
import { jsonValueSchema } from "../domain/jsonValue.js";
import { setImmediate } from "node:timers/promises";
@@ -299,6 +300,7 @@ const metadataSourceEvidence = (
}
| undefined = undefined,
previous?: AnalysisPartialObservation,
v108?: NonNullable<Awaited<ReturnType<typeof inspectIl2cppMetadataV108>>>,
) =>
createEvidence(
{
@@ -351,10 +353,16 @@ const metadataSourceEvidence = (
...(counts === undefined
? {}
: { validated_section_row_counts: { ...counts } }),
...(v108 === undefined ? {} : { version_108_partial_inventory: v108 }),
},
confidence: "observed",
limitations: [
"This partial source observation does not contain a complete metadata inventory. Section row counts, when available, are derived from the validated header extents and record layout; names and relationships may remain unexamined.",
...(v108 === undefined
? []
: [
"The version 108 header layout has not been checked against the reporter's file. Only section extents and a bounded sample of metadata strings were observed; type, method, literal, and binary layouts remain unverified and are not decoded.",
]),
],
locations: [
{ kind: "artifact-path", path: artifact.path },
@@ -470,6 +478,29 @@ export class Il2cppMetadataProvider implements Il2cppMetadataPort {
const artifact = sourceArtifact(input.path, snapshot);
observed.artifact = artifact;
assertArtifactReadActive(options?.signal);
const v108 = await inspectIl2cppMetadataV108(
snapshot.bytes,
async () => {
await this.yieldControl();
assertArtifactReadActive(options?.signal);
},
);
assertArtifactReadActive(options?.signal);
if (v108 !== null) {
const failure = new AnalysisUnsupportedTargetError(
OPERATION,
input.path,
"unsupported-version: metadata version 108 has a partial header and string observation; type, method and binary layouts are not decoded",
);
failure.partialObservation = metadataSourceEvidence(
artifact,
undefined,
selectedBinarySource(),
undefined,
v108,
);
return err(failure);
}
const limit = this.outputBytes;
const admission = createIl2cppMetadataAdmission(
limit,