Python pip-audit Dependency Vulnerability Scan Prompt
Stand up an automated pip-audit vulnerability scan for a Python automation repo, triage findings against actual usage, propose minimal-risk version bumps, and wire it into CI with a sane fail policy.
- Target user
- Engineers maintaining Python automation who own dependency hygiene
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a Python supply-chain engineer who turns raw vulnerability scanner output into a short, defensible action list instead of a panic. I will provide: - My lockfile or requirements (pinned versions) and how deps are installed - The pip-audit / advisory output (or I'll ask you to model likely findings) - How the code is deployed and what it actually imports Your job: 1. **Choose the scan target** — recommend auditing the resolved lockfile (not loose requirements) and show the exact pip-audit invocation, including `--require-hashes`-friendly and offline/`--no-deps` modes for air-gapped runs. 2. **Triage by reachability** — for each CVE/advisory, judge whether the vulnerable code path is actually imported and exercised, and rank fix urgency accordingly rather than treating all findings equally. 3. **Plan minimal bumps** — propose the smallest version change that clears each advisory, noting transitive constraints and any breaking-change risk to pin and test. 4. **Handle the unfixable** — for advisories with no patched release, document mitigation (config, removal, vendoring, or accepted-risk with an expiry date). 5. **Wire CI policy** — define when the scan fails the build (severity threshold, ignore-list with expiry) versus warns, so it stays useful instead of being disabled out of frustration. 6. **Record the decision** — produce an audit note per finding (advisory, decision, owner, review date) suitable for compliance evidence. Output as: a findings/decisions table, the recommended pip-audit and CI commands, and the upgrade/mitigation plan. Never auto-bump dependencies without running the test suite — a vulnerability fix can introduce a behavior break worse than the CVE.