Scope: Supply chain and CI/CD security standards for Python projects. Covers virtual environment isolation, reproducible lockfiles, automated vulnerability scanning (
pip-audit), pinned GitHub Actions, and secret protection in build pipelines.
Always generate and commit deterministic lockfiles to prevent malicious upstream dependency substitutions.
| Package Tool | Manifest File | Committed Lockfile |
|---|---|---|
| Poetry | pyproject.toml |
poetry.lock |
| uv | pyproject.toml |
uv.lock |
| Pipenv | Pipfile |
Pipfile.lock |
| Pip | requirements.in |
requirements.txt (via pip-compile) |
Integrate pip-audit into local development workflows and continuous integration (CI) pipelines.
# Audit active environment
pip-audit
# Audit specific requirements file
pip-audit -r requirements.txtTorusGuard Statement: Run ecosystem vulnerability tools like
pip-auditas part of your regular dependency review; TorusGuard guides secure integration boundaries but does not independently maintain CVE vulnerability feeds.
In GitHub Actions (.github/workflows/*.yml):
# ❌ VULNERABLE: Mutable tag can be hijacked
- uses: actions/checkout@v4
# ✅ SAFE: Pinned immutable commit SHA
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1permissions:
contents: read
issues: none
pull-requests: noneNever inject production secrets into untrusted pull_request workflow triggers from forks.
- Lockfiles (
poetry.lock,uv.lock, or pinnedrequirements.txt) are committed to version control. -
pip-auditruns on every pull request in CI. - GitHub Actions workflows use pinned commit SHAs and
permissions: read-all/ scoped permissions. - Package registry tokens (
PYPI_API_TOKEN) are configured as repository secrets and never hardcoded in scripts.