mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-30 19:35:06 +00:00
feat: regexp support for sigstore bundle (#10901)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
This commit is contained in:
parent
39e5808e66
commit
4287f8cc29
2 changed files with 2 additions and 12 deletions
|
@ -185,17 +185,7 @@ func buildPolicy(desc *v1.Descriptor, opts images.Options) (verify.PolicyBuilder
|
|||
}
|
||||
artifactDigestVerificationOption := verify.WithArtifactDigest(desc.Digest.Algorithm, digest)
|
||||
|
||||
// TODO: Add full regexp support to sigstore and cosign
|
||||
// Verify images only has subject field, and no subject regexp, subject cannot be passed to subject regexp
|
||||
// because then string containing the subjects will also work. We should just add an issuer regexp
|
||||
// Solve this in a separate PR,
|
||||
// See: https://github.com/sigstore/cosign/blob/7c20052077a81d667526af879ec40168899dde1f/pkg/cosign/verify.go#L339-L356
|
||||
subjectRegexp := ""
|
||||
if strings.Contains(opts.Subject, "*") {
|
||||
subjectRegexp = opts.Subject
|
||||
opts.Subject = ""
|
||||
}
|
||||
id, err := verify.NewShortCertificateIdentity(opts.Issuer, opts.Subject, "", subjectRegexp)
|
||||
id, err := verify.NewShortCertificateIdentity(opts.Issuer, opts.Subject, "", opts.SubjectRegExp)
|
||||
if err != nil {
|
||||
return verify.PolicyBuilder{}, err
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ spec:
|
|||
- entries:
|
||||
- keyless:
|
||||
issuer: https://token.actions.githubusercontent.com
|
||||
subject: https://github.com/vishal-chdhry/artifact-attestation-example/.github/workflows/*
|
||||
subjectRegExp: https://github.com/vishal-chdhry/artifact-attestation-example/.github/workflows/.+
|
||||
rekor:
|
||||
url: https://rekor.sigstore.dev
|
||||
conditions:
|
||||
|
|
Loading…
Add table
Reference in a new issue