test(setup): reject tampered packages with both signing subkeys (#14925)

This commit is contained in:
Vincent Koc
2026-11-28 03:11:08 +08:00
committed by GitHub
parent bbd1540d10
commit 1111a4642a
+9 -4
View File
@@ -70,11 +70,16 @@ describe("detached binary PGP publisher verification", () => {
});
});
it("rejects a changed payload with either signing subkey", async () => {
const payload = Buffer.from("Binary package fixture\0\xff", "latin1");
for (const signature of signatures)
expect(await verify({ payload, signature })).toMatchObject({
ok: false,
error: { reason: "invalid_signature" },
});
});
it.each([
{
defect: "changed payload",
payload: Buffer.from("Binary package fixture\0\xff", "latin1"),
},
{ defect: "malformed signature", signature: Uint8Array.of(1, 2, 3) },
{ defect: "malformed public key", key: "malformed" },
])("refuses $defect", async (input) => {