fix(checks): respect PodSecurityContext for containers #315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: aquasecurity/trivy#8210
SecurityContext
may inherit some fields fromPodSecurityContext
. See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#securitycontext-v1-coreBefore:
After:
❯ trivy conf --cache-dir cache --checks-bundle-repository localhost:5111/trivy-checks:latest test.yaml 2025-01-14T16:15:55+06:00 INFO [misconfig] Misconfiguration scanning is enabled 2025-01-14T16:15:55+06:00 INFO [misconfig] Need to update the built-in checks 2025-01-14T16:15:55+06:00 INFO [misconfig] Downloading the built-in checks... 163.59 KiB / 163.59 KiB [---------------------------------------------------------------------------------------------------] 100.00% ? p/s 100ms 2025-01-14T16:15:57+06:00 INFO Detected config files num=1