Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add require-run-as-nonroot policy that use CEL expressions #923

Merged
merged 4 commits into from
Mar 9, 2024

Conversation

jayme-github
Copy link
Contributor

@jayme-github jayme-github commented Mar 6, 2024

Related Issue(s)

Fixes: #824

Description

Add require-run-as-nonroot policy using CEL expressions.
With the CEL from 853bff9#diff-3416b7bb0c4cce31c5d5833e936ec552ea9d1426fadb6f2ec3b81bce4cb910a8 tests failed when Pod's spec.securityContext was present but spec.securityContext.runAsNonRoot was not.

Checklist

  • I have read the policy contribution guidelines.
  • I have added test manifests and resources covering both positive and negative tests that prove this policy works as intended.
  • I have added the artifacthub-pkg.yml file and have verified it is complete and correct.

Add an additional test where securityContext is present but runAsNonRoot
is not.

Fixes: kyverno#824
Signed-off-by: jayme-github <[email protected]>
@chipzoller chipzoller requested a review from MariamFahmy98 March 6, 2024 12:36
Copy link
Contributor

@chipzoller chipzoller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MariamFahmy98, would you please review? I know this test also references resources outside of the parent directory, but we can fix that on all such CEL tests later.

Copy link
Contributor

@MariamFahmy98 MariamFahmy98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chipzoller chipzoller merged commit 29e8f83 into kyverno:main Mar 9, 2024
144 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Sample] Add require-run-as-nonroot policy that use CEL expressions
3 participants