diff --git a/scripts/github/find-reusable-release-validation.sh b/scripts/github/find-reusable-release-validation.sh index 352045dec7c4..c33e0db6663f 100755 --- a/scripts/github/find-reusable-release-validation.sh +++ b/scripts/github/find-reusable-release-validation.sh @@ -329,7 +329,10 @@ for ((index = 0; index < run_count; index += 1)); do ) else .manifestVersion == 3 - and .workflowRefProof == "manifest-v3-protected-tag-exact-sha" + and ( + .workflowRefProof == "manifest-v3-protected-tag-exact-sha" + or .workflowRefProof == "manifest-v3-protected-tag-tooling-lineage" + ) and (.workflowRef | test("^release-ci/[0-9a-f]{12}-[1-9][0-9]*$")) and (.workflowRef | startswith("release-ci/\($parent.workflowSha[0:12])-")) end diff --git a/test/scripts/find-reusable-release-validation.test.ts b/test/scripts/find-reusable-release-validation.test.ts index 65267198ee0b..8c0a46bf70e5 100644 --- a/test/scripts/find-reusable-release-validation.test.ts +++ b/test/scripts/find-reusable-release-validation.test.ts @@ -667,6 +667,71 @@ describe("scripts/github/find-reusable-release-validation.sh", () => { }); }); + it("reuses strict evidence produced by an ancestor of the protected tooling tag", () => { + const { clone, priorSha } = getSharedRepo(); + const producerSha = "d".repeat(40); + const trustedWorkflowRef = `release-publish/${VERIFIER_SHA.slice(0, 12)}-456`; + const producerRef = `release-ci/${producerSha.slice(0, 12)}-122`; + const record = normalizedEvidence({ + producerSha, + targetSha: priorSha, + trustedWorkflowRef, + workflowRef: producerRef, + }); + record.current.workflowRefProof = "manifest-v3-protected-tag-tooling-lineage"; + record.root.workflowRefProof = "manifest-v3-protected-tag-tooling-lineage"; + const { binDir, fixtures, validatorPath } = setUpFixtures([{ record, runId: "111" }]); + + const result = runResolver({ + binDir, + fixtures, + repoDir: clone, + targetSha: priorSha, + trustedWorkflowRef, + validatorPath, + verifierOnMain: false, + workflowRef: `release-ci/${VERIFIER_SHA.slice(0, 12)}-123`, + }); + + expect(result.status).toBe(0); + expect(parseOutput(result.stdout)).toMatchObject({ + evidence_run_id: "111", + reuse: "true", + }); + }); + + it.each(["manifest-v3-protected-tag-diverged", "protected-tag-tooling-lineage"])( + "rejects unrecognized protected tooling proof %s", + (workflowRefProof) => { + const { clone, priorSha } = getSharedRepo(); + const trustedWorkflowRef = `release-publish/${VERIFIER_SHA.slice(0, 12)}-456`; + const producerRef = `release-ci/${VERIFIER_SHA.slice(0, 12)}-122`; + const record = normalizedEvidence({ + producerSha: VERIFIER_SHA, + targetSha: priorSha, + trustedWorkflowRef, + workflowRef: producerRef, + }); + record.current.workflowRefProof = workflowRefProof; + record.root.workflowRefProof = workflowRefProof; + const { binDir, fixtures, validatorPath } = setUpFixtures([{ record, runId: "111" }]); + + const result = runResolver({ + binDir, + fixtures, + repoDir: clone, + targetSha: priorSha, + trustedWorkflowRef, + validatorPath, + verifierOnMain: false, + workflowRef: `release-ci/${VERIFIER_SHA.slice(0, 12)}-123`, + }); + + expect(result.status).toBe(0); + expect(parseOutput(result.stdout)).toMatchObject({ reuse: "false" }); + }, + ); + it.each([ { label: "moved protected tag",