-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ReplaceSignatures #3292
Fix ReplaceSignatures #3292
Conversation
cc @developer-guy I might be missing something |
Codecov Report
@@ Coverage Diff @@
## main #3292 +/- ##
==========================================
+ Coverage 30.32% 30.59% +0.26%
==========================================
Files 155 155
Lines 9853 9858 +5
==========================================
+ Hits 2988 3016 +28
+ Misses 6418 6392 -26
- Partials 447 450 +3
|
@jonjohnsonjr I assume it is related to this issue #923 but it isn't doing what it was meant to do. |
I can see how the replace tests (added here) are failing now. |
0ca6c05
to
83e3add
Compare
Thanks! This highlights my confusion. The ReplaceSignatures bit was updating the wrapped New diff is much smaller :) |
83e3add
to
8391340
Compare
Added a test, without my diff it fails with:
Which confirms my assertion about the duplicated |
This was correctly replacing the base of the signatures but was also appending those signatures to the Get() response. So the v1.Image representation was getting out of sync with the oci.Signatures representation. Normally you won't see this because cosign doesn't do multiple attestations in the same command for the same image, so you'd roundtrip the signatures through the v1.Image being pushed and pulled, which corrects the discrepancy. If you (specifically, me) attempt to attach an attestation multiple times, the Get() will get very out of sync with the v1.Image and Replace no longer does what you'd expect because it's operating on incorrect Get() results instead of directly on the v1.Image representation. Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
8391340
to
1534cc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This was correctly replacing the base of the signatures but was also
appending those signatures to the Get() response. So the v1.Image
representation was getting out of sync with the oci.Signatures
representation.
Normally you won't see this because cosign doesn't do multiple
attestations in the same command for the same image, so you'd roundtrip
the signatures through the v1.Image being pushed and pulled, which
corrects the discrepancy.
If you (specifically, me) attempt to attach an attestation multiple
times, the Get() will get very out of sync with the v1.Image and Replace
no longer does what you'd expect because it's operating on incorrect
Get() results instead of directly on the v1.Image representation.