Skip to content

Commit

Permalink
fix disallow-privilege-escalation policy (#1179)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
  • Loading branch information
JimBugwadia authored Oct 7, 2024
1 parent 4a99f35 commit 7a219c1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ spec:
containers:
- name: container01
image: ghcr.io/kyverno/test-busybox:1.35
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: true
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -56,8 +53,6 @@ spec:
containers:
- name: container01
image: ghcr.io/kyverno/test-busybox:1.35
securityContext:
allowPrivilegeEscalation: true
- name: container02
image: ghcr.io/kyverno/test-busybox:1.35
securityContext:
Expand Down Expand Up @@ -151,9 +146,6 @@ spec:
containers:
- name: container01
image: ghcr.io/kyverno/test-busybox:1.35
securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: true
---
apiVersion: batch/v1
kind: CronJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ annotations:
kyverno/category: "Pod Security Standards (Restricted)"
kyverno/kubernetesVersion: "1.26-1.27"
kyverno/subject: "Pod"
digest: 3d361694af595b4070d5ad6ef8e65f893069209a29b7b23d026ea685393e96b5
digest: 7dcc7fc94c8c26c855804a9872be536cf327a3d4f2305ecea176eb04d2964491
createdAt: "2024-08-30T09:04:49Z"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
expressions:
- expression: >-
variables.allContainers.all(container,
container.?securityContext.?allowPrivilegeEscalation.orValue(false) == false)
container.?securityContext.allowPrivilegeEscalation.orValue(true) == false)
message: >-
Privilege escalation is disallowed.
All containers must set the securityContext.allowPrivilegeEscalation field to `false`.

0 comments on commit 7a219c1

Please sign in to comment.