Commit f550963
committed
Fix OCI verification with local cert - old bundle
`SigVerifier` is set on `CheckOpts` no matter whether the verifying
material is a public key or a certificate. The `keyBytes` function used
for comparing the verifier object was incorrectly assuming that
`SigVerifier` being non-nil meant that a local certificate was not
present and was returning the certificate's public key instead of the
certificate. This change fixes the function to check for a certificate
before returning the bytes from the public key.
It is also possible to provide a public key as an argument when a
certificate is in the signature bundle. It does not make sense to try to
provide both, but this has been allowed and asserted in
verify_blob_test.go. In this case, the comparer should ensure that the
certificate and public key are related to each other. The alternative is
to disallow providing a key as a command argument when a certificate is
present in the signature, but this could be considered a breaking
change.
This change only applies to verifying images using the old signature
format. For the new bundle format, the certificate verification goes
through a different path.
Signed-off-by: Colleen Murphy <[email protected]>1 parent 2d110ab commit f550963
File tree
3 files changed
+92
-19
lines changed- cmd/cosign/cli/verify
- pkg/cosign
3 files changed
+92
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
165 | 177 | | |
166 | 178 | | |
167 | 179 | | |
| |||
178 | 190 | | |
179 | 191 | | |
180 | 192 | | |
181 | | - | |
| 193 | + | |
182 | 194 | | |
183 | 195 | | |
184 | 196 | | |
185 | 197 | | |
186 | 198 | | |
187 | 199 | | |
188 | 200 | | |
189 | | - | |
| 201 | + | |
190 | 202 | | |
191 | 203 | | |
192 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
193 | 207 | | |
194 | 208 | | |
195 | 209 | | |
| |||
300 | 314 | | |
301 | 315 | | |
302 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
303 | 326 | | |
304 | 327 | | |
305 | 328 | | |
306 | 329 | | |
307 | | - | |
| 330 | + | |
308 | 331 | | |
309 | 332 | | |
310 | 333 | | |
311 | 334 | | |
312 | 335 | | |
313 | 336 | | |
314 | | - | |
| 337 | + | |
315 | 338 | | |
316 | 339 | | |
317 | 340 | | |
| |||
365 | 388 | | |
366 | 389 | | |
367 | 390 | | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | 391 | | |
378 | 392 | | |
379 | 393 | | |
380 | 394 | | |
381 | 395 | | |
382 | | - | |
| 396 | + | |
383 | 397 | | |
384 | 398 | | |
385 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
945 | 945 | | |
946 | 946 | | |
947 | 947 | | |
948 | | - | |
| 948 | + | |
949 | 949 | | |
950 | | - | |
| 950 | + | |
951 | 951 | | |
952 | 952 | | |
953 | 953 | | |
954 | | - | |
955 | 954 | | |
956 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
957 | 965 | | |
958 | 966 | | |
959 | 967 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
329 | 380 | | |
330 | 381 | | |
331 | 382 | | |
| |||
0 commit comments