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