Skip to content

Commit 180ecbe

Browse files
authored
Merge pull request #6 from ToxMCP/ci/dep-audit-gate
ci: add hardened pip-audit dependency-audit gate
2 parents ff10679 + 6cc4ba4 commit 180ecbe

2 files changed

Lines changed: 80 additions & 3 deletions

File tree

.github/workflows/dep-audit.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Dependency Audit
2+
3+
# Hardened, fail-on-ANY dependency vulnerability gate (pip-audit).
4+
#
5+
# Why a separate workflow + weekly schedule:
6+
# pip-audit queries a LIVE advisory database (PyPI Advisory DB / OSV). A green
7+
# main can go stale when a NEW CVE lands on an already-pinned, unchanged dep.
8+
# The weekly cron re-audits the locked tree against the current advisory feed
9+
# so newly disclosed advisories surface without any code change.
10+
#
11+
# Why fail-on-any (no severity filter, no "|| true"):
12+
# pip-audit already exits non-zero on ANY advisory regardless of severity.
13+
# `--strict` additionally fails the run on audit errors (e.g. an unreachable
14+
# advisory source) instead of silently passing. This is deliberately NOT
15+
# severity-gated and is NOT swallowed.
16+
17+
on:
18+
pull_request:
19+
push:
20+
branches: [ main ]
21+
schedule:
22+
# Weekly, Monday 06:17 UTC (off-peak). Live advisory DB => catches new CVEs
23+
# landing on already-pinned deps.
24+
- cron: "17 6 * * 1"
25+
workflow_dispatch:
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
pip-audit:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.11"
39+
40+
# Match the toolchain CI already uses (see ci.yml): Poetry 2.2.1 with an
41+
# in-project virtualenv built from the committed poetry.lock.
42+
- name: Upgrade Poetry toolset
43+
run: pip install --upgrade "poetry>=2.2.1"
44+
45+
- name: Install Poetry
46+
uses: snok/install-poetry@v1
47+
with:
48+
version: 2.2.1
49+
virtualenvs-create: true
50+
virtualenvs-in-project: true
51+
52+
# Install the full, locked project dependency set (runtime + dev), exactly
53+
# as ci.yml does, so the audit covers what the repo actually resolves.
54+
- name: Install dependencies
55+
run: poetry install --no-root --with dev
56+
57+
# pip-audit itself is installed INTO the project venv so the audit runs in
58+
# "environment" mode against the already-installed locked distributions.
59+
# This avoids requirements re-resolution (which trips on env markers such
60+
# as backports-asyncio-runner; python_version < "3.12") and audits exactly
61+
# what is installed from poetry.lock.
62+
- name: Install pip-audit
63+
run: poetry run pip install "pip-audit>=2.9.0"
64+
65+
# Keep the runner's bundled pip current so the gate enforces the project's
66+
# locked dependency set rather than a stale toolchain artifact.
67+
- name: Refresh build tooling
68+
run: poetry run pip install --upgrade pip
69+
70+
# FAIL-ON-ANY audit of the full installed dependency set.
71+
# --strict : also fail on audit errors (unreachable source, etc.)
72+
# --desc : print advisory descriptions for triage
73+
# No severity filter and no "|| true": ANY advisory turns this job RED.
74+
# Note: the first-party package "o-qt-mcp-server" is not on PyPI and is
75+
# skipped by pip-audit -- that is expected, not a miss.
76+
- name: pip-audit (fail on any advisory)
77+
run: poetry run pip-audit --strict --desc

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)