Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ results:
- badpod05
- badpod06
- badpod07
- badpod08
result: fail
rule: check-seccomp-strict
- kind: CronJob
Expand Down Expand Up @@ -86,5 +87,6 @@ results:
- goodpod08
- goodpod09
- goodpod10
- goodpod11
result: pass
rule: check-seccomp-strict
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ spec:
- name: container01
image: dummyimagename
---
apiVersion: v1
kind: Pod
metadata:
name: badpod08
spec:
containers:
- name: container01
image: dummyimagename
---
###### Pods - Good
apiVersion: v1
kind: Pod
Expand Down Expand Up @@ -275,6 +284,18 @@ spec:
seccompProfile:
type: RuntimeDefault
---
apiVersion: v1
kind: Pod
metadata:
name: goodpod11
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: container01
image: dummyimagename
---
###### Deployments - Bad
apiVersion: apps/v1
kind: Deployment
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: 66cf094f57c592abe9378262ca46d3860bf5cbdb67cc9d53654eaf784549b916
digest: 48f7fa6426ef41733bbb9a9292c199a3b5abcf664cc3e2b0eb32c030188e1f3a
createdAt: "2023-12-04T09:04:49Z"
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,40 @@ spec:
validate:
cel:
expressions:
- expression: >-
- expression: >-
!object.spec.?securityContext.?seccompProfile.?type.hasValue() ||
object.spec.securityContext.seccompProfile.type == 'RuntimeDefault' ||
object.spec.securityContext.seccompProfile.type == 'Localhost'
message: >-
Use of custom Seccomp profiles is disallowed. The field
spec.securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`.
- expression: >-

- expression: >-
object.spec.containers.all(container,
!container.?securityContext.?seccompProfile.?type.hasValue() ||
container.securityContext.seccompProfile.type == 'RuntimeDefault' ||
container.securityContext.seccompProfile.type == 'Localhost'
(container.?securityContext.?seccompProfile.?type.orValue('') in ['RuntimeDefault', 'Localhost']) ||
(!container.?securityContext.?seccompProfile.?type.hasValue() && object.spec.?securityContext.?seccompProfile.?type.orValue('') in ['RuntimeDefault', 'Localhost'])
Comment thread
harinandhreddy0411 marked this conversation as resolved.
)
message: >-
Use of custom Seccomp profiles is disallowed. The field
spec.containers[*].securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`.

- expression: >-
spec.containers[*].securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`,
or inherited from spec.securityContext.seccompProfile.type.

- expression: >-
object.spec.?initContainers.orValue([]).all(container,
!container.?securityContext.?seccompProfile.?type.hasValue() ||
container.securityContext.seccompProfile.type == 'RuntimeDefault' ||
container.securityContext.seccompProfile.type == 'Localhost'
(container.?securityContext.?seccompProfile.?type.orValue('') in ['RuntimeDefault', 'Localhost']) ||
(!container.?securityContext.?seccompProfile.?type.hasValue() && object.spec.?securityContext.?seccompProfile.?type.orValue('') in ['RuntimeDefault', 'Localhost'])
)
message: >-
Use of custom Seccomp profiles is disallowed. The field
spec.initContainers[*].securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`.
spec.initContainers[*].securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`,
or inherited from spec.securityContext.seccompProfile.type.

- expression: >-
- expression: >-
object.spec.?ephemeralContainers.orValue([]).all(container,
!container.?securityContext.?seccompProfile.?type.hasValue() ||
container.securityContext.seccompProfile.type == 'RuntimeDefault' ||
container.securityContext.seccompProfile.type == 'Localhost'
(container.?securityContext.?seccompProfile.?type.orValue('') in ['RuntimeDefault', 'Localhost']) ||
(!container.?securityContext.?seccompProfile.?type.hasValue() && object.spec.?securityContext.?seccompProfile.?type.orValue('') in ['RuntimeDefault', 'Localhost'])
)
message: >-
Use of custom Seccomp profiles is disallowed. The field
spec.ephemeralContainers[*].securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`.
spec.ephemeralContainers[*].securityContext.seccompProfile.type must be set to `RuntimeDefault` or `Localhost`,
or inherited from spec.securityContext.seccompProfile.type.
Loading