Skip to content

Commit 72135c4

Browse files
committed
refactor: update Bandit configuration for improved security reporting
1 parent 8cfcbc9 commit 72135c4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

spec/ci-cd/design.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,13 @@ On push feature/* or schedule:
9292
scan on image + SBOM, SARIF upload to GitHub Security), and
9393
`container-structure-tests`. All three must pass before a release job runs.
9494

95-
7. **Bandit uses project `.bandit` config**
96-
— Bandit is invoked as `bandit -r middleware/ -c .bandit -ll`, delegating
97-
all severity and exclusion configuration to the `.bandit` file checked into
98-
the repository. This keeps CI and local development behaviour consistent.
95+
7. **Bandit uses project `.bandit` config; pass/fail driven by JSON report**
96+
— Bandit runs as `bandit -r middleware/ -c .bandit -f json`, capturing all
97+
findings regardless of severity. A post-processing step prints every finding
98+
(including LOW) for visibility, then exits non-zero only when MEDIUM or HIGH
99+
findings are present. This keeps exclusion and threshold configuration in the
100+
`.bandit` file and avoids the `-ll` flag, which would suppress LOW findings
101+
entirely and contradict the requirement to log them.
99102

100103
8. **CodeQL config excludes `dev_environment/`**
101104
— A `.github/codeql/codeql-config.yml` file instructs CodeQL to skip the

spec/principles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ All code must pass:
7373
- `uv run ruff check middleware/` — linting
7474
- `uv run mypy middleware/` — static type checking
7575
- `uv run pylint middleware/` — style and code smells
76-
- `uv run bandit -r middleware/ -c .bandit -ll` — security
76+
- `uv run bandit -r middleware/ -c .bandit` — security (low findings logged, medium/high fail)
7777

7878
**Suppression comments** (`# noqa`, `# type: ignore`, `# pylint: disable`) are
7979
a last resort. A real fix is always preferred.

0 commit comments

Comments
 (0)