Add Cosign verification support#1598
Conversation
|
To do: Needs documentation of the |
657eeb5 to
3939152
Compare
|
Manual testing results:
Example {
"type": "cosignSigned",
"keyPath": "/some/path/to/cosign.pub",
"signedIdentity": {
"type": "matchRepository"
}
}So, good? NOTE the Still, this must not be merged without unit tests. |
9ddfefb to
3a4b0f9
Compare
|
Added documentation. |
| Exactly one of `keyPath` and `keyData` must be present, containing a Cosign public key. Only signatures made by this key is accepted. | ||
|
|
||
| The `signedIdentity` field has the same semantics as in the `signedBy` requirement described above. | ||
| Note that `cosign`-created signatures only contain a repository, so only `matchRepository` and `exactRepository` can be used to accept them (and that does not protect against substitution of a signed image with an unexpected tag). |
There was a problem hiding this comment.
… and remapIdentity, useful for non-registries.conf mirroring, does not work for repo-only signatures like that.
|
Needs a rebase |
|
I am running out of time today but I will have a look tomorrow morning. |
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... which can have "optional": null . Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
|
Code changes since the review:
I’d appreciate a sanity-check of the added tests as well. |
type: cosignSigned, with the usual keyData/keyPath. Fulcio/Rekor is not currently implemented. NOTE: This only allows a single public key, not a keyring, unlike simple signing. That seems problematic, there are known users of that. But we can fix that later by adding keyDirectory and the like. NOTE: Cosign interoperability requires use of signedIdentity: matchRepository. The fairly useful signedIdentity: remapIdentity has no repository-match functionality. NOTE: Multi-arch images need to be signed by cosign with --recursive to be accepted; c/image enforces signatures per platform. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
|
Now ready for review and possibly merging. |
Fixed a typo in an error message, removed a few FIXME comments. |
|
|
||
| // FIXME: rename Signatures to UnverifiedSignatures | ||
| // FIXME: pass context.Context | ||
| // FIXME: Use image.UntrustedSignatures, use that to improve error messages (needs tests!) |
There was a problem hiding this comment.
Outstanding, noted in #1601 .
⚠️ Warning: This is write-only code, as in I haven’t read it after myself, it has never been run, and it has no tests yet. Might be completely broken.It really needsunit andan integration tests, and interoperability testing.type: cosignSigned, with the usualkeyData/keyPath. Fulcio/Rekor is plausible for the off-line Rekor log entry proofs, but not currently implemented. Tests first.Note: This only allows a single public key, not a keyring, unlike simple signing. That seems problematic, there are known users of that. But we can fix that later by adding
keyDirectoryand the like.Depends on unmerged #1594 and #1596.