Provider evidence expires two hours after issue, so no repo tool could re-verify a release before deploying it later or rolling back to it. verify:promotion --archived keeps every signature, digest and member check and judges freshness at the recorded promotion time; the FE-RB-005 drill takes the extracted release with --release-root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.3 KiB
TypeScript
49 lines
2.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { promotionEvidenceTime } from "../../scripts/lib/exact-promotion-bundle.ts";
|
|
import { evaluatePromotionEvidence } from "../../scripts/lib/provider-evidence.ts";
|
|
import { syntheticSignedPromotionBundle } from "./security-followup-fixture.ts";
|
|
|
|
// 13-04. Provider evidence lives two hours at most, so a promoted release could
|
|
// not be re-verified the next day, which the rollback runbook requires. The
|
|
// archived mode checks freshness at the recorded promotion time instead.
|
|
const promotedAt = Date.parse("2026-08-02T01:00:00.000Z");
|
|
const threeHoursLater = promotedAt + 3 * 60 * 60 * 1_000;
|
|
|
|
function evidenceAt(freshness: "current" | "archived", now: number) {
|
|
const fixture = syntheticSignedPromotionBundle();
|
|
const provider = JSON.parse(fixture.files["provider-verification.json"].toString("utf8"));
|
|
return evaluatePromotionEvidence({
|
|
expected: {
|
|
run: provider.run,
|
|
source: provider.source,
|
|
candidate: provider.candidate,
|
|
vulnerabilityInvocationNonce: provider.providerEvidence.vulnerabilityInvocationNonce,
|
|
provenanceInvocationNonce: provider.providerEvidence.provenanceInvocationNonce,
|
|
secretScanAttestation: provider.providerEvidence.secretScanAttestation,
|
|
},
|
|
localStatus: "PASS",
|
|
vulnerabilityReport: JSON.parse(fixture.files["vulnerability-report.json"].toString("utf8")),
|
|
provenanceAttestation: JSON.parse(fixture.files["provenance-attestation.json"].toString("utf8")),
|
|
vulnerabilityTrust: fixture.verification.vulnerabilityTrust,
|
|
provenanceTrust: fixture.verification.provenanceTrust,
|
|
nowEpochMs: () => promotionEvidenceTime(freshness, provider.verifiedAt, now),
|
|
});
|
|
}
|
|
|
|
describe("archived promotion re-verification", () => {
|
|
it("accepts evidence three hours after promotion in archived mode only", () => {
|
|
expect(evidenceAt("archived", threeHoursLater).status).toBe("PASS");
|
|
expect(evidenceAt("current", threeHoursLater)).toMatchObject({
|
|
status: "FAIL_UNVERIFIED",
|
|
failures: expect.arrayContaining(["vulnerability report is expired"]),
|
|
});
|
|
});
|
|
|
|
it("refuses a promotion time recorded in the future", () => {
|
|
expect(() =>
|
|
promotionEvidenceTime("archived", "2026-08-02T05:00:00.000Z", promotedAt),
|
|
).toThrow(/verifiedAt is in the future/u);
|
|
});
|
|
});
|