ci: audit DiffBio's lock through substrax's audit-lock action - #31
Merged
Merged
Conversation
The Security job ran `uv run --with pip-audit pip-audit --local`, which audits the environment pip-audit runs in, not DiffBio's lock, so a green audit said nothing about DiffBio's dependencies. The job now uses substrax's audit-lock action, pinned by commit, which exports every extra the lock resolves and audits each export with a pinned pip-audit and a fresh advisory cache. Bandit keeps its command in its own step, which runs after a failed audit too; either failure fails the job. The whole-lock audit reported four advisories, all in the docs extra, and the lock closes each: - mkdocs-material 9.7.6 -> 9.7.7: PYSEC-2026-3864 - pymdown-extensions 10.21.2 -> 12.1: PYSEC-2026-2999, PYSEC-2026-3609, PYSEC-2026-3654 `mkdocs build --strict` passes with the new lock, and its pages match the old lock's except for the theme version and asset hashes.
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.
Why
The Security job ran
uv run --with pip-audit pip-audit --local --desc. That command audits the environment pip-audit itself runs in, not DiffBio's lock. A green result therefore said nothing about DiffBio's dependencies, and no extra outside that environment was ever audited.What
security.yml: the audit is now substrax'saudit-lockaction,avitai/substrax/.github/actions/audit-lock@13e98b78127606be04437bd7c5de894fb765a28e. It is pinned by commit like thealready-testedgate and runs aftersetup-diffbio, which installs uv. The action exports every extra inuv.lock, in groups that respect[tool.uv] conflicts, and audits each export with pip-audit 2.10.1 throughuvx, using a fresh advisory cache. It fails on any advisory that[tool.substrax.audit-lock.ignore]inpyproject.tomldoes not name, and on any ignore entry that no advisory matches. DiffBio needs no ignores, so the table is absent.Bandit keeps its exact command but moves into its own step with
if: ${{ !cancelled() }}, so it still runs after a failed audit. A failure in either step fails the job. The uploaded artifact now holds onlybandit-report.json.Lock changes. The whole-lock audit of
mainfound four advisories, all in thedocsextra:search.suggest.Only these two packages moved (
uv lock --upgrade-package ... --refresh-package ...).CHANGELOG
[Unreleased]entries.Tests
tests/test_ci_security.py(new) checks four things: the audit is the shared action pinned to a full SHA, uv is set up before it, no step runspip-audit, and bandit runs after a failed audit with no captured exit status. All four tests failed before the workflow change and pass after it.pytest tests/test_ci_security.py tests/test_ci_concurrency.py tests/test_ci_docs.py --no-cov: 21 passed.pre-commit run --all-files: exit 0.uv lock --check: exit 0.bandit -c pyproject.toml -r src/diffbio/: no issues.docs.ymlis path-filtered and does not run on a change touv.lockalone, so the strict build was run locally from a scratch environment synced from this lock.mkdocs build --clean --strictexits 0. Its 128 HTML pages match a build with the old versions, apart from the theme version string and the asset hashes.13e98b7, run locally: onmainit reports the four advisories (exit 1); on this branch it reports none (exit 0).