pipguard
Python supply chain security tool. Scan packages before installing them.
AST-based static analysis + known CVE lookup via osv.dev.
pip install pipguard
pipguard install litellm==1.82.8 # Blocks the March 2026 attack. Exits 1.
Zero configuration. Zero external dependencies. Pure stdlib.
The Problem
The March 2026 litellm attack (97M downloads/month) embedded Python code in a .pth
file — executed automatically at interpreter startup, exfiltrating SSH keys, AWS credentials,
and Kubernetes configs from a single pip install.
Classical tools (pip-audit, GuardDog) are blind to zero-day attacks. They check known signatures. pipguard asks a different question:
Should any
pip installbe allowed to read~/.ssh/id_rsa?
The answer is no. And that question doesn't require a database.
Installation
Install pipguard outside your project's virtualenv — this prevents untrusted package code from tampering with the scanner itself.
# Recommended: isolated, persistent install
pipx install pipguard
# CI / one-off use (no pre-install needed)
uvx pipguard install -r requirements.txt
# Standard
pip install pipguard
Usage
# Install a single package
pipguard install requests
# Install from requirements.txt
pipguard install -r requirements.txt
# CI mode: never prompts, exits 1 on CRITICAL/HIGH
pipguard install --yes -r requirements.txt
# Allow a known-legitimate package that accesses credentials
pipguard install --allow paramiko -r requirements.txt
# Override for known false-positives (use with care)
pipguard install --force my-trusted-internal-pkg
# Show full LOW/CLEAN scan details
pipguard install --verbose requests
# Show raw pip install output
pipguard install --show-pip-output requests
By default, pipguard prints a risk summary, expands CRITICAL / HIGH / MEDIUM,
collapses LOW to package-level counts, and keeps successful pip install logs quiet.
Use --verbose for full scan details and --show-pip-output to restore raw pip logs.
For the full reference — risk levels, exit codes, allowlist, and CI integration — see the documentation.
CI Integration
GitHub Actions
Use the bundled composite action to gate installs in a workflow — it fails the job on CRITICAL/HIGH findings:
- uses: shenxianpeng/pipguard@v0.2.0
with:
requirements: requirements.txt
check-vulns: true # also query OSV.dev for known CVEs (optional)
Or scan explicit packages:
- uses: shenxianpeng/pipguard@v0.2.0
with:
packages: "requests numpy==1.26.3"
pre-commit
Add pipguard to .pre-commit-config.yaml to scan your requirements file before every commit that changes it:
repos:
- repo: https://github.com/shenxianpeng/pipguard
rev: v0.2.0
hooks:
- id: pipguard
# scans requirements.txt by default; override for a different file:
# args: ['-r', 'requirements/prod.txt']
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pipguard-0.4.0.tar.gz.
File metadata
- Download URL: pipguard-0.4.0.tar.gz
- Upload date:
- Size: 399.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b3c165f377ba9266bf97f276e7426ccea23709b54295a1528ef2a9844ea0f43
|
|
| MD5 |
19baf90257b31842ffedee40a13fddc8
|
|
| BLAKE2b-256 |
353780fa6f7c0332e5f66f672fcd7a5acf66cff91004bf27f0bfc07eafe76a4d
|
Provenance
The following attestation bundles were made for pipguard-0.4.0.tar.gz:
Publisher:
publish.yml on shenxianpeng/pipguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipguard-0.4.0.tar.gz -
Subject digest:
0b3c165f377ba9266bf97f276e7426ccea23709b54295a1528ef2a9844ea0f43 - Sigstore transparency entry: 2159348304
- Sigstore integration time:
-
Permalink:
shenxianpeng/pipguard@5f844cfbba97357f031b856629f55dc18275cd9c -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f844cfbba97357f031b856629f55dc18275cd9c -
Trigger Event:
push
-
Statement type:
File details
Details for the file pipguard-0.4.0-py3-none-any.whl.
File metadata
- Download URL: pipguard-0.4.0-py3-none-any.whl
- Upload date:
- Size: 36.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94a39d565060f47166f1df4a40f41f39fced5f10a5f31c57eb82258f873e9ce2
|
|
| MD5 |
f32d747954b1df2815bfedb19182c343
|
|
| BLAKE2b-256 |
ab78136fd933d6e7b6216f7998ec88cad8ed6903e41bc55f9303c33ce0f84249
|
Provenance
The following attestation bundles were made for pipguard-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on shenxianpeng/pipguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipguard-0.4.0-py3-none-any.whl -
Subject digest:
94a39d565060f47166f1df4a40f41f39fced5f10a5f31c57eb82258f873e9ce2 - Sigstore transparency entry: 2159348349
- Sigstore integration time:
-
Permalink:
shenxianpeng/pipguard@5f844cfbba97357f031b856629f55dc18275cd9c -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/shenxianpeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f844cfbba97357f031b856629f55dc18275cd9c -
Trigger Event:
push
-
Statement type: