-
Notifications
You must be signed in to change notification settings - Fork 385
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… 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>
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.
Code LGTM
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. |
logrus.Debugf("GetSignaturesWithAcceptedAuthor for image %s", policyIdentityLogName(image.Reference())) | ||
reqs := pc.requirementsForImageRef(image.Reference()) | ||
|
||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outstanding, noted in #1601 .
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
⚠️ 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
keyDirectory
and the like.Depends on unmerged #1594 and #1596.