Feature Request
Add a `--threshold` CLI flag that causes DockSec to exit with a non-zero code when the computed security score falls below a user-defined minimum. This is the single most-requested integration feature for CI/CD pipelines — it enables teams to enforce security gates automatically.
Proposed Usage
# Fail the build if score < 70
docksec Dockerfile -i myapp:latest --threshold 70
# In GitHub Actions / Jenkins / GitLab CI:
- run: docksec Dockerfile -i $IMAGE --threshold 80
# Step fails if security score < 80, blocking the deployment
Expected Behavior
DockSec Security Score: 64/100
[FAILED] Security score 64 is below the required threshold of 70.
Deployment blocked. Fix the issues above and re-scan.
Exit code: 1
DockSec Security Score: 87/100
[PASSED] Security score 87 meets the required threshold of 70.
Exit code: 0
Implementation Plan
- Add `--threshold` argument to `docksec.py` argparse (integer, 0–100, default: None)
- After score calculation, compare score against threshold
- Print a clear PASS/FAIL message with Rich console formatting
- Exit with code `1` on failure, `0` on pass
- Threshold of `None` (not provided) = current behavior (always exit 0)
- Add `--threshold` to `--scan-only` mode too (use rule-based score, no LLM needed)
Edge Cases to Handle
- `--threshold 0` → always pass (warn user this is a no-op)
- `--threshold 100` → valid (very strict gate)
- `--threshold 101` or negative → argparse error before scan starts
- Score calculation failure → warn and exit 2 (infrastructure error, not a security failure)
CLI Argument Addition (`docksec.py`)
parser.add_argument(
"--threshold",
type=int,
metavar="SCORE",
default=None,
help="Minimum security score (0-100). Exit with code 1 if score is below this value. "
"Useful for CI/CD pipeline gates. Example: --threshold 70"
)
Acceptance Criteria
Related Issues
Feature Request
Add a `--threshold` CLI flag that causes DockSec to exit with a non-zero code when the computed security score falls below a user-defined minimum. This is the single most-requested integration feature for CI/CD pipelines — it enables teams to enforce security gates automatically.
Proposed Usage
Expected Behavior
Implementation Plan
Edge Cases to Handle
CLI Argument Addition (`docksec.py`)
Acceptance Criteria
Related Issues