Skip to content

ci: add dependency audit workflow#3138

Open
PascalThuet wants to merge 2 commits into
github:mainfrom
PascalThuet:split/dependency-audit
Open

ci: add dependency audit workflow#3138
PascalThuet wants to merge 2 commits into
github:mainfrom
PascalThuet:split/dependency-audit

Conversation

@PascalThuet

@PascalThuet PascalThuet commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Part of splitting #2442 into smaller, dedicated PRs. This is the original #2438 ask — the dependency-audit workflow — re-derived against current main.

What

  • New .github/workflows/security.yml with dependency-audit coverage split by trigger:
    • push / PR / manual: one deterministic dependency-audit job audits the committed .github/security-audit-requirements.txt snapshot with pip-audit --require-hashes.
    • weekly schedule: dependency-audit-scheduled compiles the runtime + test dependency set live per (os, python) matrix entry (ubuntu/windows × 3.11/3.12/3.13) and audits that, to catch newly published advisories the committed snapshot wouldn't.
  • .github/scripts/check_security_requirements.py: a sync gate that fails a PR which changed pyproject.toml (or the snapshot) without regenerating the committed requirements.
  • .github/security-audit-requirements.txt: the committed --universal --generate-hashes snapshot (generated against current main).
  • tests/test_security_workflow.py: static guards for the jobs, matrix, pins, hashed snapshot, and the sync script. Triggers are asserted by inclusion so the follow-up baseline-gate PR can add labeled/unlabeled without rewriting the test.
  • CONTRIBUTING.md: a "Security checks" subsection documenting the local commands.

Why

Gives CI a deterministic dependency-advisory signal on every PR plus a live scheduled sweep, without a lockfile or redundant PR matrix runs.

Validation

  • tests/test_security_workflow.py — 12 passed.
  • uvx ruff check .github/scripts/check_security_requirements.py tests/test_security_workflow.py is clean.
  • pip-audit --require-hashes against the committed snapshot reports no known vulnerabilities.
  • A fresh uv pip compile ... --no-header is byte-identical to the committed snapshot (sync gate passes).
  • Actions pinned to commit SHAs (actions/checkout aligned to the repo-standard 9c091bb... # v7.0.0).

Bandit + secret-scan gates are deliberately not here — they come in a follow-up PR so each gate reviews on its own. Independent of the other split PRs.

Disclosure: Updated on behalf of @PascalThuet by Codex (model: GPT-5, autonomous).

Add a Security Audit workflow with a dependency-audit job. Push/PR/manual
runs pip-audit against a committed --generate-hashes requirements snapshot
(.github/security-audit-requirements.txt) for deterministic CI, while the
weekly scheduled run resolves the runtime + test dependency set live across
the supported Python/OS matrix to surface newly published advisories.

A sync gate (.github/scripts/check_security_requirements.py) fails PRs whose
dependency inputs changed without refreshing the committed snapshot, so the
committed file can't silently drift from pyproject.toml.
@PascalThuet PascalThuet requested a review from mnriem as a code owner June 23, 2026 21:51
Assisted-by: Codex (model: GPT-5, autonomous)
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