Skip to content

fix(ci): audit this project's dependencies, not the scanners' - #19

Merged
livingstaccato merged 1 commit into
mainfrom
ci/audit-the-project-not-the-scanner
Sep 5, 2026
Merged

fix(ci): audit this project's dependencies, not the scanners'#19
livingstaccato merged 1 commit into
mainfrom
ci/audit-the-project-not-the-scanner

Conversation

@livingstaccato

Copy link
Copy Markdown
Member

The defect

.github/workflows/security.yml audited an environment that contained no project dependencies at all:

- run: |
    uv venv                                   # empty environment
    uv pip install bandit safety pip-audit    # the only things in it
- run: |
    source .venv/bin/activate
    pip-audit || true                         # audits bandit, safety, pip-audit

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. || 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 the same arrangement: safety pulls in nltk, nltk drew 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:

  • exports the resolved lock (uv export --no-emit-workspace), dev groups included, so a vulnerable test-time dependency still counts;
  • runs pip-audit from uvx, which puts the scanner's own dependencies in a separate environment;
  • lets the exit status through. That is only safe once the subject is correct, which is why the two changes belong together.

safety is dropped. It was installed but never invoked, and its check subcommand 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:

==> auditing 173 locked packages
No known vulnerabilities found

Noted, not fixed

pyproject.toml has a [tool.bandit] section that the workflow never reaches: it installs plain bandit rather than bandit[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

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
@livingstaccato
livingstaccato merged commit a82576c into main Sep 5, 2026
29 checks passed
@livingstaccato
livingstaccato deleted the ci/audit-the-project-not-the-scanner branch September 5, 2026 02:50
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