fix(ci): audit this project's dependencies, not the scanners' - #19
Merged
Conversation
The dependency audit ran as:
uv venv
uv pip install bandit safety pip-audit
source .venv/bin/activate
pip-audit || true
`uv venv` builds an empty environment and nothing installs the project
into it, so the only packages pip-audit could see were bandit, safety,
pip-audit and their transitive dependencies. The step audited the
scanners and nothing else. `|| true` then discarded the exit status, so
neither the misdirection nor a genuine finding could turn the build red.
wrknv hit the visible half of this: `safety` pulls in `nltk`, `nltk`
drew an unpatched advisory, and the build went red over a package that
appears nowhere in the lock. This repo was spared only because it
swallowed the result.
`scripts/audit_dependencies.sh` audits the resolved lock, dev groups
included, and runs pip-audit from `uvx` so the scanner's own
dependencies are in a separate environment. With the subject correct the
exit status is worth having, so it is no longer discarded. safety goes
with the old arrangement: it was installed but never invoked, and its
`check` subcommand has been deprecated since June 2024.
Verified against the current lock: 173 packages, no known
vulnerabilities.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dhi1SLuFiEseRhH9iLMv8Q
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.
The defect
.github/workflows/security.ymlaudited an environment that contained no project dependencies at all:Nothing installs this project into that virtualenv. The only packages pip-audit could see were the three scanners and their transitive dependencies, so the step reported on them and nothing else.
|| truethen discarded the exit status, so neither the misdirection nor a genuine finding could turn the build red.wrknv hit the visible half of the same arrangement:
safetypulls innltk,nltkdrew an unpatched advisory (PYSEC-2026-3740), and the build went red over a package that appears nowhere in its lock. This repo was spared only because it swallowed the result.The fix
scripts/audit_dependencies.sh:uv export --no-emit-workspace), dev groups included, so a vulnerable test-time dependency still counts;uvx, which puts the scanner's own dependencies in a separate environment;safetyis dropped. It was installed but never invoked, and itschecksubcommand has been deprecated since June 2024.Bandit is unaffected — it reads source, not installed packages — and keeps its own environment.
Verification
Run against the current lock:
Noted, not fixed
pyproject.tomlhas a[tool.bandit]section that the workflow never reaches: it installs plainbanditrather thanbandit[toml]and passes no-c pyproject.toml, so that configuration is silently ignored. Separate defect, left alone here.🤖 Generated with Claude Code
https://claude.ai/code/session_01Dhi1SLuFiEseRhH9iLMv8Q