Skip to content
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

feat: keyless #1659

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

feat: keyless #1659

wants to merge 1 commit into from

Conversation

phbelitz
Copy link
Member

Adds support for keyless cosign verification. This feature allows users to verify images signed with cosign without the need for a public key.

fixes #1493

Checklist

  • PR is rebased to/aimed at branch develop
  • PR follows Contributing Guide
  • Added tests (if necessary)
  • Extended README/Documentation (if necessary)
  • Adjusted versions of image and Helm chart in Chart.yaml (if necessary)

Adds support for keyless cosign verification. This feature allows users to verify images signed with cosign without the need for a public key.

fixes #1493
@phbelitz
Copy link
Member Author

phbelitz commented Jun 14, 2024

Integration tests and documentation are still missing and values.yaml needs to be reverted ...

Copy link
Member

@Starkteetje Starkteetje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the mental capacity today to review this fully, but here are some preliminary comments

@@ -125,6 +125,13 @@ application:
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEsx28WV7BsQfnHF1kZmpdCTTLJaWe
d0CA+JOi8H4REuBaWSZ5zPDe468WuOJ6f71E7WFg3CVEVYHuoZt2UYbN/Q==
-----END PUBLIC KEY-----
- name: keyless
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out, I can see this as an example, but it shouldn't be part of the default config


func ValidateCertificate(cert string) error {
certPool := x509.NewCertPool()
if !certPool.AppendCertsFromPEM([]byte(cert)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not really what this function is supposed to check.

// AppendCertsFromPEM attempts to parse a series of PEM encoded certificates.
// It appends any certificates found to s and reports whether any certificates
// were successfully parsed.

If there is a single valid certificate inside the bytestring and then a bunch of garbage, this succeeds

Also a nit: the return value is never used in its form and could be a bool with as IsValidCert or similar

Suggested change
if !certPool.AppendCertsFromPEM([]byte(cert)) {
return certPool.AppendCertsFromPEM([]byte(cert))

internal/validator/auth/trust_root.go Show resolved Hide resolved
@@ -478,7 +478,7 @@ func TestValidateErrors(t *testing.T) {
},
},
},
"Key must be set if Cert isn't",
"Key is a required field",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not true, though?

Comment on lines +129 to +131
cv.RekorPubkey = valData.Host.RekorPubkey
cv.FulcioCert = valData.Host.FulcioCert
cv.CTLogPubkey = valData.Host.CTLogPubkey
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way to validate the pub keys?

func (cv *CosignValidator) getFulcioCerts() (*x509.CertPool, *x509.CertPool, error) {
if cv.FulcioCert != "" {
root := x509.NewCertPool()
// certificate was already validated during unmarshalling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, why do we even put the bytestring into the CosignValidator in the first place? It is unserialized into a CosignValidatorYaml, so we could make the cv.Cert and cv.FulcioCert field the cert pool with the added certificate during validation already, or am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants