Repository navigation
fix(kubernetes): report the container at fault in KSV-0024, KSV-0119 and KSV-0120 - #654
Open
arpitjain099 wants to merge 2 commits into
Open
arpitjain099 wants to merge 2 commits into
arpitjain099 wants to merge 2 commits into
Conversation
…and KSV-0120 Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
nikpivkin
requested changes
Nov 14, 2026
nikpivkin
left a comment
Contributor
There was a problem hiding this comment.
The failHostPorts, failCapsNetRaw and failCapsSysModule defaults are not used anywhere. This PR already removes getContainersWitNohDisallowedHostPorts, so drop them too.
| } | ||
|
|
||
| # Each offending container is reported once, named, and not as a dump of the whole | ||
| # container object. |
Contributor
There was a problem hiding this comment.
The comment describes the old bug, which will not exist after merge. Drop "and not as a dump of the whole container object".
…psSysModule defaults These default definitions are no longer referenced after removing getContainersWitNohDisallowedHostPorts, and the SYS_MODULE test comment no longer needs to describe the old behaviour. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Contributor
Author
|
Thanks @nikpivkin. I dropped the three unused defaults (failHostPorts, failCapsNetRaw, failCapsSysModule) and reworded the SYS_MODULE test comment to drop the old-behaviour phrasing. fmt and the Rego tests pass. Please let me know if you want anything else changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
All three checks build a set of the offending containers, then iterate that set again inside the
sprintf, so the message and the cause come from unrelated iterations.KSV-0024 also tests container objects for membership in a set of container names, which never matches, so
denyruns over every container in the pod. A pod with one container that sets ahostPortand one that does not gets two findings, both naming the first container, and one of them pointing at the container that is fine. In KSV-0119 the cause is a name rather than a container, so the findings carry no line numbers. KSV-0120 prints the container object itself in the message and reports one finding per pair of offending containers.Each check now walks the offending containers once and passes the container to
result.new, as the other container checks here do.Checked with trivy 0.76.1 reading the checks from this tree: KSV-0024 drops from two findings to one, on the right lines, and KSV-0120 from four to two.