A Service of type ExternalName which points back to localhost can potentially be used to exploit vulnerabilities in some Ingress controllers. This policy audits Services of type ExternalName if the externalName field refers to localhost.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: no-localhost-serviceannotations:policies.kyverno.io/title: Disallow Localhost ExternalName Services in CEL expressionspolicies.kyverno.io/category: Sample in CELpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Servicepolicies.kyverno.io/minversion: 1.11.0kyverno.io/kubernetes-version: 1.26-1.27policies.kyverno.io/description: A Service of type ExternalName which points back to localhost can potentially be used to exploit vulnerabilities in some Ingress controllers. This policy audits Services of type ExternalName if the externalName field refers to localhost.spec:validationFailureAction: Auditbackground: truerules:- name: no-localhost-servicematch:any:- resources:kinds:- Serviceoperations:- CREATE- UPDATEvalidate:cel:expressions:- expression: object.spec.type != 'ExternalName' || object.spec.externalName != 'localhost'message: Service of type ExternalName cannot point to localhost.
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.