Allow signing local image without registry access #3841
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.
Summary
This PR attempts to address #3832 - it will allow generating local signature for an image (when
--upload=false
) by using--output-signature
/--output-artifact
/--output-payload
even when the remote registry is not accessible or the image hasn't yet been pushed there. Details are in the linked issue.I only implemented this for the case the image is passed in by digest right now - it's easier to do and the code says we're going to eventually disable referencing images by tag, so I don't think it's strictly necessary there (but let me know if you think otherwise).
Verification of such signature requires the
--insecure-tlog-verify
(a.k.a.--private-infrastructure
) flag, which seems a little weird to me, but I think that's not something that I introduced by this PR. After some investigation, I think this is caused by the fact that the locally written files don't seem to represent a full bundle (like the one that can be generated with signing a blob or the one that gets pushed as an OCI artifact with--upload=true
) and hence the locally createdfakeOCISignatures
object can't be used correctly in theVerifyBundle
function inpkg/cosign/verify.go
. I think maybe a better way to solve all of this would be to rather allow writing out full bundles for images, like we allow forsign-blob
?Release Note
Documentation
I think the release note should be fine, but please correct me if I'm wrong.