feat(managed): select declaring types in inspect_managed_members
Select exact declaring types before managed signatures and CIL bodies are decoded, preserving caller choices in CLI/MCP Evidence. Keep unmatched names and selected coverage explicit; comparisons and graphs retain unknowns outside their observed scope. Reuse existing metadata ownership/accounting and advertise unique selections through the actual SDK Schema. Validated with 229 focused tests across 21 files, 11 managed conformance controls, fullstatic/docs checks and real Linux CLI and fresh MCP inspection of two unchanged DLLs. All 118 selected CIL hashes matched original PE-mapped bytes; result/caller-argument parity and unmatched controls passed. Full artifact/native-boundary metadata is complete; whole-assembly members retain the unchanged 64 MiB resource constraint. No target code executes. Refs #1878 Co-authored-by: skared <190618464+skoodster@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
co-authored by
skared
Claude Opus 5.5
Ysopwnable
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Kaoru0822
parent
f28f338283
commit
a149d183ef
@@ -459,9 +459,83 @@ describe("managed member comparison of ambiguous undecoded signatures", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const inspect = (bytes: Buffer, path: string) => {
|
||||
describe("managed member comparison of selected types", () => {
|
||||
it("keeps members outside the other side's selection unknown", () => {
|
||||
const left = inspect(buildManagedPeFixture(), "/tmp/left-all.dll");
|
||||
const right = inspect(buildManagedPeFixture(), "/tmp/right-selected.dll", [
|
||||
"Missing.Type",
|
||||
]);
|
||||
const result = compareManagedMembers(
|
||||
{ evidenceId: left.evidenceId, result: left.result },
|
||||
{ evidenceId: right.evidenceId, result: right.result },
|
||||
);
|
||||
|
||||
expect(result.summary).toMatchObject({ added: 0, removed: 0, unknown: 2 });
|
||||
expect(result.methods[0]).toMatchObject({
|
||||
status: "unknown",
|
||||
left: { token: "0x06000001" },
|
||||
right: null,
|
||||
});
|
||||
expect(result.coverage.status).toBe("partial");
|
||||
expect(result.limitations).toContain(
|
||||
"The observations select different declaring types; a member outside the other side's selection is unknown, not added or removed.",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not remap members across types neither side observed", () => {
|
||||
const left = inspect(buildManagedPeFixture(), "/tmp/left-a.dll", [
|
||||
"Fixture.Program",
|
||||
]);
|
||||
const right = inspect(
|
||||
buildManagedPeFixture({
|
||||
mvid: Buffer.from("00112233445566778899aabbccddeefe", "hex"),
|
||||
typeName: "A",
|
||||
typeNamespace: "X",
|
||||
}),
|
||||
"/tmp/right-b.dll",
|
||||
["X.A"],
|
||||
);
|
||||
const result = compareManagedMembers(
|
||||
{ evidenceId: left.evidenceId, result: left.result },
|
||||
{ evidenceId: right.evidenceId, result: right.result },
|
||||
);
|
||||
|
||||
expect(result.matching.exact_il_signature).toBe(0);
|
||||
expect(result.summary).toMatchObject({
|
||||
unchanged: 0,
|
||||
added: 0,
|
||||
removed: 0,
|
||||
unknown: 4,
|
||||
});
|
||||
});
|
||||
|
||||
it("compares two identical selections within those types", () => {
|
||||
const left = inspect(buildManagedPeFixture(), "/tmp/left-sel.dll", [
|
||||
"Fixture.Program",
|
||||
]);
|
||||
const right = inspect(buildManagedPeFixture(), "/tmp/right-sel.dll", [
|
||||
"Fixture.Program",
|
||||
]);
|
||||
const result = compareManagedMembers(
|
||||
{ evidenceId: left.evidenceId, result: left.result },
|
||||
{ evidenceId: right.evidenceId, result: right.result },
|
||||
);
|
||||
|
||||
expect(result.methods[0]).toMatchObject({ status: "unchanged" });
|
||||
expect(result.coverage.status).toBe("complete-within-inputs");
|
||||
expect(result.limitations).toContain(
|
||||
"Both observations cover only the selected declaring types (Fixture.Program); member totals and statuses describe those types, not the whole assembly.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const inspect = (bytes: Buffer, path: string, typeNames?: string[]) => {
|
||||
const target = managedPeFixtureTarget(bytes, path);
|
||||
const result = inspectManagedMembersBytes(bytes, target);
|
||||
const result = inspectManagedMembersBytes(
|
||||
bytes,
|
||||
target,
|
||||
typeNames === undefined ? {} : { typeNames },
|
||||
);
|
||||
return {
|
||||
result,
|
||||
evidenceId: `ev_${hash(Buffer.from(path))}`,
|
||||
|
||||
Reference in New Issue
Block a user