ClusterRoles that grant write permissions over admission webhook should be minimized to reduce powerful identities in the cluster. This policy checks to ensure write permissions are not provided to admission webhooks.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: restrict-clusterrole-mutating-validating-admission-webhooksannotations:policies.kyverno.io/title: Restrict Clusterrole for Mutating and Validating Admission Webhookspolicies.kyverno.io/category: Otherpolicies.kyverno.io/severity: mediumkyverno.io/kyverno-version: 1.10.7kyverno.io/kubernetes-version: "1.27"policies.kyverno.io/subject: ClusterRolepolicies.kyverno.io/description: ClusterRoles that grant write permissions over admission webhook should be minimized to reduce powerful identities in the cluster. This policy checks to ensure write permissions are not provided to admission webhooks.spec:validationFailureAction: Auditbackground: truerules:- name: restrict-clusterrolematch:any:- resources:kinds:- ClusterRolevalidate:message: Use of verbs `create`, `update`, and `patch` are forbidden for mutating and validating admission webhooksforeach:- list: request.object.rules[]deny:conditions:all:- key: "{{ element.apiGroups || '' }}"operator: AnyInvalue:- admissionregistration.k8s.io- key: "{{ element.resources || '' }}"operator: AnyInvalue:- mutatingwebhookconfigurations- validatingwebhookconfigurationsany:- key: "{{ element.verbs }}"operator: AnyInvalue:- create- update- patch- key: "{{ contains(element.verbs[], '*') }}"operator: Equalsvalue: true
This policy prevents the use of the default project in an Application.
Services of type LoadBalancer when deployed inside AWS have support for transport encryption if it is enabled via an annotation. This policy requires that Services of type LoadBalancer contain the annotation service.beta.kubernetes.io/aws-load-balancer-ssl-cert with some value.
This policy prevents updates to the project field after an Application is created.