Silence bandit nosec noise in test_entrypoints #17
No reviewers
Labels
No labels
upstream-feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
tim/omnimem!17
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bandit-nosec-noise"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The security scan printed 20 lines of "nosec encountered (B104), but no failed test" for mcp_server/tests/test_entrypoints.py (lines 523, 535-542, 553).
Cause: a
# nosec B104on a multi-line statement or dict makes bandit warn for every neighbouring AST node on those lines that has no B104 of its own. The suppression itself is still needed: the three "0.0.0.0" literals are real B104 findings without it.Fix: one module-level
ALL_INTERFACES = "0.0.0.0" # nosec B104with a comment explaining why, used in the three places. The per-line nosec comments are gone.Verified in a python:3.14 container with the CI commands:
bandit -r mcp_server web_ui rss_worker -ll: 0 "nosec encountered" warnings, 0 medium/high issues (base file: 20 warnings)pytest --cov=memory --cov=toolsin mcp_server: 2008 passed, 1 skipped🤖 Generated with Claude Code
https://claude.ai/code/session_0137rmvr4GcRbtoEvABScjsT