Phase 2b: add --fail-on gate and CI-friendly 0/1/2/3 exit codes#120
Merged
Conversation
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.
Summary
Adds a
--fail-on <severity>CI gate and standardizes exit codes to a conventional0/1/2/3 scheme so DockSec can gate builds and be scripted reliably. Second of the
Phase 2 sequence.
Changes
--fail-on <severity>(CRITICAL/HIGH/MEDIUM/LOW): exit 1 when any structured finding(image vulnerability or compose misconfiguration) is at or above the threshold.
--fail-onis below the requested--severity, the scan severity is widenedautomatically so the gate can observe those findings (with an info message).
0clean,1findings at/above--fail-on,2usage/argument error,3tool/runtime error. Phase 1's scan-failure exit moves from 1 to 3 for consistency.Severity.rank()/Severity.gate_levels()helpers.Notes
json_data); Hadolint lint warnings are notseverity-ranked and do not trip the gate.
--fail-on, a clean run still exits 0.Testing
ruff check .passes.pytest: 114 passed (newtest_enums.py; gate helper + exit-code integration tests).gate hit=1, clean/below-threshold=0, auto-widen fires.