fix(rules): read securityOpt entries and capabilities the way Docker does - #91
Merged
Merged
Conversation
…does
Move the reading of a "securityOpt" entry and of a capability name into
dockerargs, so the rules share one answer to how Docker splits and matches
them.
securityOpt entries were split on "=" only, and only against a fixed set of
literal spellings, which both missed and misreported configurations:
- "seccomp:unconfined" went unreported. Docker falls back to ":" as the
separator in an entry holding no "=".
- "no-new-privileges=1" was read as unset. The value is a boolean, which
Docker reads with strconv.ParseBool.
- "seccomp=builtin" was reported as overriding the default profile. Docker
passes the name straight through and the daemon loads the same profile it
would with no seccomp option at all, so it is the default, not an
override. The match is exact, so "seccomp=BUILTIN" still names a file.
Capability names now go through one normalization — upper-cased, "CAP_"
prefixed, with "ALL" standing on its own — which also reaches the "capAdd"
property, where "all" previously went unreported.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JMeKPpNA7DkazGxjXRrk3q
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.
Move the reading of a "securityOpt" entry and of a capability name into
dockerargs, so the rules share one answer to how Docker splits and matches
them.
securityOpt entries were split on "=" only, and only against a fixed set of
literal spellings, which both missed and misreported configurations:
separator in an entry holding no "=".
Docker reads with strconv.ParseBool.
passes the name straight through and the daemon loads the same profile it
would with no seccomp option at all, so it is the default, not an
override. The match is exact, so "seccomp=BUILTIN" still names a file.
Capability names now go through one normalization — upper-cased, "CAP_"
prefixed, with "ALL" standing on its own — which also reaches the "capAdd"
property, where "all" previously went unreported.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01JMeKPpNA7DkazGxjXRrk3q