MCPcopy Create free account
hub / github.com/cli/cli / signerWorkflowSANPattern

Function signerWorkflowSANPattern

pkg/cmd/attestation/verify/policy.go:46–52  ·  view source on GitHub ↗

signerWorkflowSANPattern builds the SAN pattern enforced for --signer-workflow. sigstore-go matches SAN patterns with regexp.MatchString, which is unanchored, so a pattern anchored only at the start is a prefix match: a workflow named release.yml.attacker.yml satisfies a pin on release.yml. Anchori

(workflowURL string)

Source from the content-addressed store, hash-verified

44// "main@refs/heads/attacker", a pin on refs/heads/main would still admit a certificate
45// built from a different branch.
46func signerWorkflowSANPattern(workflowURL string) string {
47 pattern := "^" + regexp.QuoteMeta(workflowURL)
48 if signerWorkflowHasRef.MatchString(workflowURL) {
49 return pattern + "$"
50 }
51 return pattern + "(" + signerWorkflowRefPattern + ")?$"
52}
53
54func expandToGitHubURL(tenant, ownerOrRepo string) string {
55 if tenant == "" {

Callers 1

validateSignerWorkflowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected