This policy example will check if a certificate is issued by a trusted Certificate Authority.The policy will be non-compliant if the certificate is not issued by a trusted Certificate Authority.
package mainimport rego.v1default allow := falseca := "base64-encoded-ca"allow if { ca_list := x509cert.issuers(input.Data["ca-crt"]) x509cert.is_issued_by_trusted_ca(ca, ca_list)}# If input.Data['ca-crt'] does not exist, the policy should also be compliantallow if { not input.Data["ca-crt"]}
This policy verifies that a given certificate is only issued by a trusted Certificate Authority.