fix(sign): trust cosign's unsigned answer only when the registry lists no signature bundle - #1239
Merged
Merged
Conversation
…s no signature bundle
cosign verify detects the bundle format with a referrers listing and, when
that listing fails for any reason -- the registry throttling the per-identity
referrers lookups of a busy pass -- falls back silently to the legacy signature
tag and reports "no signatures found". The pre-check took that for an unsigned
digest and signed it again: a duplicate signature and Rekor entry per affected
digest, in batches of one per worker every time the throttle tripped.
The pre-check now logs the verify's error at debug level, and confirms an
"unsigned" answer against the registry's referrers list before signing:
a listed signature bundle means the lookup was throttled and the verify is
retried with backoff; a listing that fails for good, or a verify that fails
for a reason other than an unsigned digest or another identity's signature,
fails the tag instead of signing it. The TUF cache race between concurrent
cosign processes ("failed to persist metadata") joins the transient set.
Closes #1237
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1237.
What
retagger signverifies a digest before signing it and signs when the verify fails. The pre-check nowhasSignatureBundle, a filtered referrers listing with the credentials cosign uses). A listed bundle means cosign's lookup was throttled: the verify is retried with the usual backoff, up tocosignAttemptstimes;failed to persist metadata) as transient.The retry loop of
cosign()moved intoretrying(), shared with the referrers listing.go-containerregistryis the new dependency for the listing.Why
cosign v3
verifyauto-detects the bundle format with one referrers listing and, when that listing fails for any reason, silently switches to the legacy signature-tag path, which reports the digest unsigned. The registry throttles referrers listings per identity (1000 per 60 s,TOOMANYREQUESTS); a sign-all pass with four workers trips that limit about every 80 s, and the four in-flight pre-checks then read "no signatures found" and sign the digests again. Reproduced with 36 concurrent verifies of signed digests: 235 of 261 failures were "no signatures found", 17 the explicitTOOMANYREQUESTS, the rest the TUF cache race.Verification
sign-allpass; the skopeo-file jobs must report0 signedfor tags whose digest did not change. Result on sign: a failing pre-check verify is silent and re-signs the digest #1237.