Wildcards ('*') in resources grants access to all of the resources referenced by the given API group and does not follow the principal of least privilege. As much as possible, avoid such open resources unless scoped to perhaps a custom API group. This policy blocks any Role or ClusterRole that contains a wildcard entry in the resources list found in any rule.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: restrict-wildcard-resourcesannotations:policies.kyverno.io/title: Restrict Wildcards in Resourcespolicies.kyverno.io/category: Security, EKS Best Practicespolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: ClusterRole, Role, RBACkyverno.io/kyverno-version: 1.7.0policies.kyverno.io/minversion: 1.6.0kyverno.io/kubernetes-version: "1.23"policies.kyverno.io/description: Wildcards ('*') in resources grants access to all of the resources referenced by the given API group and does not follow the principal of least privilege. As much as possible, avoid such open resources unless scoped to perhaps a custom API group. This policy blocks any Role or ClusterRole that contains a wildcard entry in the resources list found in any rule.spec:validationFailureAction: Auditbackground: truerules:- name: wildcard-resourcesmatch:any:- resources:kinds:- Role- ClusterRolevalidate:message: Use of a wildcard ('*') in any resources is forbidden.deny:conditions:any:- key: "{{ contains(request.object.rules[].resources[], '*') }}"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.