Repository navigation
Description
Problem
The --key / --public-key path shipped for skills (#6447, #6478) and plugins (#6524, #6525, #6528) with unit tests only, by agreement on #6442 — the push side did not exist on plugins until the last PR, and cosign is not on the E2E runner. Every test of the path drives the mocked verifier.Verifier; nothing has ever exercised the real signer → registry → verifier chain for a key-pair signature end to end.
That leaves a specific class of bug invisible: a mismatch between what signer.SignOCI writes for a key-pair signature (simple-signing payload, .sig manifest layout, annotations) and what verifier.VerifyOCIWithKey / VerifyBundleOfflineWithKey expect to read back. The mocks agree with each other by construction. bundleSignsPayload (the anti-transplant check) and the "payload recovered from the stored bundle, not rebuilt from a reference" fix in #6525 are exactly the kind of logic that only a real round trip validates.
Proposed scope
Add one Ginkgo spec per surface to test/e2e/ (the plugins side can extend cli_plugins_lock_test.go, which already has the registry + project harness):
cosign generate-key-pairinto a temp dir (or check in a fixed test key pair; a checked-in key removes thecosignbinary dependency and is fine for a test that asserts behaviour, not secrecy).thv skill build/thv ai-plugin build, thenpush --key cosign.keyto the local registry withCOSIGN_PASSWORDset on thethv serveprocess.install --scope project --public-key cosign.pub; assert the lock entry haspublicKeyand nosignerIdentity, andinforenders "cosign key pair".installagain with no flag → uses the pinned key;installwith a different--public-key→ 403 conflict.sync --check→AlreadyCurrent; tamper with the on-disk tree → drift →syncrepairs via the pinned key.upgradeafter pushing a new version signed with the same key → upgraded; after pushing one signed with a different key →failed [signature-invalid]with the reinstall remedy; after pushing keyless →signer-change-blocked.install --allow-unsignedon the key-signed artifact with no key → 403 naming--public-key, not a recorded unsigned exception.
Also assert the key-signing capability from #6560: a push --key from a client without the discovery capability is refused.
Related
--keypush signing has no install-time verification path (plugins) #6442test/e2e/cli_plugins_lock_test.go(existing harness)
Activity
arian-gogani commentedon Sep 14, 2026
"The mocks agree with each other by construction" is the diagnosis, and I think it also decides how the specs should be accepted rather than just what they should cover.
Seven scenarios against a real round trip will all pass on the first run. That is the expected outcome and it is also indistinguishable from seven scenarios that would pass against a broken implementation, which is the same property the mocks already have. The specs replace one source of agreement-by-construction with another unless something proves they can fail.
The two bugs are already named in the issue, which makes this cheap:
bundleSignsPayload, the anti-transplant check. Break it to a constant true, or lift the bundle from a different artifact into the manifest, and run the suite. Some spec must go red. If none does, the transplant case is not covered no matter how many specs exist.The payload-rebuilt-from-reference fix in #6525. Revert that one line locally so the payload is reconstructed rather than recovered from the stored bundle, and run again. Some spec must go red.
Two mutants, two runs, maybe twenty minutes, and it turns "we added E2E coverage" into "we added coverage that provably catches the two failures we were worried about". Anything still green under a planted bug can be dropped or rewritten, which is also the cheapest way to keep the suite small.
Worth pointing at scenario 6 specifically. The three upgrade outcomes (same key, different key, keyless) are the ones most likely to pass for the wrong reason, because
failed [signature-invalid]andsigner-change-blockedare different codes for adjacent conditions. A spec asserting only that the upgrade failed would stay green if the two were swapped. Asserting the exact code is what separates them, and a mutant that swaps them is a third cheap thing to plant.The checked-in key pair is the right call. A test asserting behaviour rather than secrecy does not need key generation, and removing the
cosignbinary dependency is worth more than the realism it costs.I have spent most of this week on this specific problem in a conformance suite, where the suite was green with several genuine fail-opens live in it, and the only thing that surfaced them was re-planting each defect and checking which cases actually fired. Four of the new cases turned out to be decoration. I would rather have learned that at authoring time than trusted them for a year.