A ClusterRole with nodes/proxy resource access allows a user to perform anything the kubelet API allows. It also allows users to bypass the API server and talk directly to the kubelet potentially circumventing audits and admission controllers. See https://blog.aquasec.com/privilege-escalation-kubernetes-rbac for more info. This policy prevents the creation of a ClusterRole if it contains the nodes/proxy resource.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: restrict-clusterrole-nodesproxyannotations:policies.kyverno.io/title: Restrict ClusterRole with Nodes Proxy in CEL expressionspolicies.kyverno.io/category: Sample in CELpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: ClusterRole, RBACkyverno.io/kyverno-version: 1.11.0policies.kyverno.io/minversion: 1.11.0kyverno.io/kubernetes-version: 1.26-1.27policies.kyverno.io/description: "A ClusterRole with nodes/proxy resource access allows a user to perform anything the kubelet API allows. It also allows users to bypass the API server and talk directly to the kubelet potentially circumventing audits and admission controllers. See https://blog.aquasec.com/privilege-escalation-kubernetes-rbac for more info. This policy prevents the creation of a ClusterRole if it contains the nodes/proxy resource. "spec:validationFailureAction: Auditbackground: truerules:- name: clusterrole-nodesproxymatch:any:- resources:kinds:- ClusterRoleoperations:- CREATE- UPDATEvalidate:cel:expressions:- expression: object.rules == null || !object.rules.exists(rule, has(rule.resources) && rule.resources.exists(resource, resource == 'nodes/proxy') && rule.apiGroups.exists(apiGroup, apiGroup == ''))message: A ClusterRole containing the nodes/proxy resource is not allowed.
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.