var naming

Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
Meredith Lancaster 2024-11-26 13:38:09 -07:00
parent a326f5cb18
commit 92c623ab54

View file

@ -51,34 +51,34 @@ func (c EnforcementCriteria) Valid() error {
}
func (c EnforcementCriteria) BuildPolicyInformation() string {
template :=
policyInfo :=
fmt.Sprintf(`
The following policy criteria will be enforced against all attestations:
- Predicate type must match %s`, c.PredicateType)
if c.Certificate.RunnerEnvironment == GitHubRunner {
runnerInfo := "\n- Attestation must have been generated by an Action workflow executed in a GitHub hosted runner"
template += runnerInfo
policyInfo += runnerInfo
}
ownerUriInfo := fmt.Sprintf("\n- Source Repository Owner URI must match %s", c.Certificate.SourceRepositoryOwnerURI)
template += ownerUriInfo
policyInfo += ownerUriInfo
if c.Certificate.SourceRepositoryURI != "" {
repoUriInfo := fmt.Sprintf("\n- Source Repository URI must match %s", c.Certificate.SourceRepositoryURI)
template += repoUriInfo
policyInfo += repoUriInfo
}
issuerInfo := fmt.Sprintf("\n- Signing certificate's OIDC issuer must match %s", c.Certificate.Issuer)
template += issuerInfo
policyInfo += issuerInfo
if c.SAN != "" {
sanInfo := fmt.Sprintf("\n- Signing certificate Subject Alternative Name must match %s", c.SAN)
template += sanInfo
policyInfo += sanInfo
} else if c.SANRegex != "" {
sanRegexInfo := fmt.Sprintf("\n- Signing certificate Subject Alternative Name must match the regex %s", c.SANRegex)
template += sanRegexInfo
policyInfo += sanRegexInfo
}
return template
return policyInfo
}