Skip to content

Exclude tests/ from Bandit scanning - #33

Open
jthDEV wants to merge 1 commit into
mainfrom
ci/exclude-tests-from-bandit
Open

Exclude tests/ from Bandit scanning#33
jthDEV wants to merge 1 commit into
mainfrom
ci/exclude-tests-from-bandit

Conversation

@jthDEV

@jthDEV jthDEV commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • GitHub Advanced Security currently reports Bandit's B101 ("assert_used") for every assert in tests/ (e.g. tests/test_nuget.py, and now also the new tests/test_swift.py / tests/test_cocoapods.py)
  • B101 exists because assert is stripped when Python runs with -O — a real concern for security checks in production code, but assert in tests/ is just pytest's normal assertion mechanism and never runs under -O
  • Adds excluded_paths: tests to .github/workflows/bandit.yml so the scan stops flagging test files, keeping the signal for actual production code

Test plan

  • Workflow YAML change only, no application code touched
  • Bandit action's excluded_paths input confirmed via the action's own inline documentation comments in the workflow file

assert is pytest's normal assertion mechanism, not a stripped-in-
production security check — Bandit's B101 ("assert_used") flags every
occurrence regardless of context, which just produces noise for the
whole tests/ directory in GitHub Advanced Security.
@jthDEV
jthDEV requested a review from gr-markin August 26, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant