diff --git a/pkg/cmd/attestation/verification/policy.go b/pkg/cmd/attestation/verification/policy.go index 845b0a207..b5d641688 100644 --- a/pkg/cmd/attestation/verification/policy.go +++ b/pkg/cmd/attestation/verification/policy.go @@ -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 }