Repository navigation
fix(exceptions): resolve ephemeral container paths for containerName exceptions - #196
Merged
matthyx merged 1 commit intoNov 10, 2026
Conversation
…exceptions Container rules now report Pod findings on spec.ephemeralContainers[N], but the failed-path parser only knew containers[N] and initContainers[N]. The finding fell back to the whole-workload scan, so an exception for container "app" also silenced a finding on an ephemeral "debugger" container, and an exception naming the ephemeral container never matched. Parse ephemeralContainers[N] paths and include ephemeral containers in the fallback scan. Signed-off-by: KVR Vishnu <46535652+VISHNU0906@users.noreply.github.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
matthyx
approved these changes
Nov 10, 2026
matthyx
left a comment
Contributor
There was a problem hiding this comment.
Reviewed head a32044a against main. No blockers: the change is needed and correct. Approving.
Non-blocking: in the new ephemeralContainerNames helper, a malformed entry without a string name is appended as "". Skipping it would be tidier, but this is harmless in practice.
This was referenced Nov 10, 2026
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.
Overview
The regolibrary container rules now report Pod findings on
spec.ephemeralContainers[N](e.g.container-hostPort,set-seLinuxOptions).extractFailingContainerNamesonly recognisedcontainers[N]andinitContainers[N], so for those findings it returned nothing andcompareContainerNamefell back to scanning the regular and init containers. Two things go wrong:containerName: appalso silences a finding on the ephemeraldebuggercontainer in the same Pod, which is the case a0483ba set out to prevent;This change parses
ephemeralContainers[N]paths and adds ephemeral containers to the fallback scan. The pinned k8s-interface version has no ephemeral container getter, so the names are read fromspec.ephemeralContainersin a small helper.How to Test
TestSetRuleResponsExceptions_EphemeralContainerPrecisiongoes throughSetRuleResponsExceptionswith a Pod that hasappand an ephemeraldebugger: exception on the failing ephemeral container applies, exception onappdoes not, and the no-paths fallback findsdebugger.TestComparator_compareContainerNamegets an ephemeral case, plus a unit test for the helper.go test -race ./...,go test ./... -covermode=countandgo build ./...pass; golangci-lint shows the same two existing staticcheck findings as on main.cc @matthyx