Privilege escalation, such as via set-user-ID or set-group-ID file mode, should not be allowed. This policy ensures the `allowPrivilegeEscalation` field is set to `false`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: disallow-privilege-escalationannotations:policies.kyverno.io/title: Disallow Privilege Escalation in CELpolicies.kyverno.io/category: Pod Security Standards (Restricted) in CELpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/minversion: 1.11.0kyverno.io/kyverno-version: 1.11.0kyverno.io/kubernetes-version: 1.26-1.27policies.kyverno.io/description: Privilege escalation, such as via set-user-ID or set-group-ID file mode, should not be allowed. This policy ensures the `allowPrivilegeEscalation` field is set to `false`.spec:validationFailureAction: Auditbackground: truerules:- name: privilege-escalationmatch:any:- resources:kinds:- Podoperations:- CREATE- UPDATEvalidate:cel:variables:- name: allContainersexpression: object.spec.containers + object.spec.?initContainers.orValue([]) + object.spec.?ephemeralContainers.orValue([])expressions:- expression: variables.allContainers.all(container, container.?securityContext.allowPrivilegeEscalation.orValue(true) == false)message: Privilege escalation is disallowed. All containers must set the securityContext.allowPrivilegeEscalation field to `false`.
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.