Commit 5323148
committed
cosign: fix image signature verification by tag
For a tag (e.g. :latest), there is no reference.digest().
image-rs falls back to image.manifest_digest, which comes from pull_manifest
in the image pull path.
Cosign (and sigstore triangulation) uses fetch_manifest_digest for that
ref — the same digest cosign verify uses.
For multi-arch images, pull_manifest can be a platform-specific child
while the signature (and triangulation) refer to the list/index digest,
so the two strings don’t match even when verification is correct.
verify_signature_and_get_payload now returns (payloads, source_image_digest),
where source_image_digest is the digest from client.triangulate
(same as cosign’s triangulation / fetch_manifest_digest).
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Assisted-by: AI
For the payload digest check:
* @sha256:… in the reference -> still use reference digest.
* Tag only (:latest, etc.) -> use triangulated_manifest_digest, not pull_manifest’s digest.
So tag pulls stay aligned with cosign verify --key … image:tag.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>1 parent 00b55b2 commit 5323148
1 file changed
Lines changed: 15 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
145 | | - | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
154 | | - | |
| 157 | + | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
212 | 215 | | |
213 | 216 | | |
214 | 217 | | |
215 | | - | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
| |||
0 commit comments