fix(javascript)!: bind runtime identities to capture evidence (#10063)

fix(javascript)!: bind runtime graph identities to capture Evidence
This commit is contained in:
morluto authored and GitHub committed 2026-11-11 18:18:22 +08:00
1 parent b4d501e714
commit 3eb502ae5d
7 files changed
+258 -4

No files matched your search

@@ -411,6 +411,7 @@ describe("JavaScript Application Graph: identity and evidence", () => {
identity: {
strategy: "runtime-instance",
stability: "capture-only",
capture_evidence_id: `ev_${"c".repeat(64)}`,
capture_sha256: "6".repeat(64),
runtime_key: "script-preload",
},
@@ -811,6 +812,50 @@ describe("JavaScript Application Graph: duplicate and orphan rejection", () => {
});
});
it("rejects runtime identities without an explicit capture Evidence identifier", () => {
expect(() =>
createJavaScriptApplicationNode({
kind: "runtime-script-instance",
identity: {
strategy: "runtime-instance",
stability: "capture-only",
capture_sha256: APPLICATION_GRAPH_DIGESTS.capture,
runtime_key: "script-preload",
},
observations: [
{
label: null,
properties: {},
evidence: runtimeEvidence("script-preload"),
},
],
}),
).toThrow(/capture_evidence_id/u);
});
it("requires runtime identities to retain their capture Evidence provenance", () => {
const runtimeWithUnrelatedEvidence = createJavaScriptApplicationNode({
kind: "runtime-script-instance",
identity: {
strategy: "runtime-instance",
stability: "capture-only",
capture_evidence_id: `ev_${"d".repeat(64)}`,
capture_sha256: APPLICATION_GRAPH_DIGESTS.capture,
runtime_key: "script-preload",
},
observations: [
{
label: null,
properties: {},
evidence: runtimeEvidence("script-preload"),
},
],
});
expect(() => graphForNode(runtimeWithUnrelatedEvidence)).toThrow(
/identity is not supported/u,
);
});
describe("JavaScript Application Graph: identity strategy requirements", () => {
it("requires every identity strategy to have compatible supporting evidence", () => {
const mismatchedPath = createJavaScriptApplicationNode({
@@ -841,6 +886,7 @@ describe("JavaScript Application Graph: identity strategy requirements", () => {
identity: {
strategy: "runtime-instance",
stability: "capture-only",
capture_evidence_id: `ev_${"c".repeat(64)}`,
capture_sha256: APPLICATION_GRAPH_DIGESTS.capture,
runtime_key: "script-preload",
},