Assume cosign.key as key field in signing secret#3067
Assume cosign.key as key field in signing secret#3067simonbaird merged 2 commits intoconforma:mainfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
9b2e103 to
7b0897c
Compare
|
Acceptance tests pass for me locally. I just rebased, let's see how it goes. |
40b7de5 to
170b14f
Compare
internal/validate/vsa/attest.go
Outdated
| signerVerifier, err := LoadPrivateKey(keyBytes, []byte(os.Getenv("COSIGN_PASSWORD"))) | ||
| // For Kubernetes secret keys, derive the password reference from the key reference | ||
| var pwKeyRef string | ||
| if strings.HasPrefix(keyRef, "k8s://") { |
There was a problem hiding this comment.
Does this logic need to be here? It looks similar to what's going on in utils.PasswordFromKeyRef.
I want to use this and have it dwim:
--vsa-signing-key k8s://conforma/vsa-signing-key
Ref: https://issues.redhat.com/browse/EC-1589
Co-authored-by: Claude Code <noreply@anthropic.com>
In the PR for https://issues.redhat.com/browse/EC-1586 I began creating the signing secret using the same kind of GitOps job that Konflux uses for the Chains signing secret. As a side-effect of that, we now have a signing key with a password, which I think doesn't quite work as it should. Rather than create the secret without a password, let's improve things a little so we can use the password conveniently. Note: This would be simpler if we stopped supporting the signing secret in a file, with the COSIGN_PASSWORD, but I think maybe we wanna keep that since it might be useful in non-Konflux environments. Ref: https://issues.redhat.com/browse/EC-1589
170b14f to
deed361
Compare
|
Let's merge. |
User description
I want to use this and have it dwim:
Also added a commit to read a password from the signing key secret and use it.
Ref: https://issues.redhat.com/browse/EC-1589
PR Type
Enhancement
Description
Default to
cosign.keyfield when no key specified in Kubernetes secret referenceAllows simplified secret reference syntax without explicit key field
Added comprehensive test coverage for default key behavior
Supports both single-key and multi-key secrets with
cosign.keyfallbackDiagram Walkthrough
File Walkthrough
private_key.go
Auto-append cosign.key to secret referencesinternal/utils/private_key.go
fmtandstringsimports for string manipulation/cosign.keyto key references withoutexplicit key field
only namespace and secret name provided
specifications
private_key_test.go
Add tests for default cosign.key behaviorinternal/utils/private_key_test.go
default behavior
field not found"
cosign.keyfield as defaultcosign.keyexists amongmultiple keys
cosign.keyfieldcases