pip-check-safety
Scan pip packages for security risks before and after installation.
Features
- Pre-installation checks: Scan packages before you install them
- Typosquatting detection: Catch packages trying to impersonate popular libraries
- Code scanning: Detect suspicious patterns like crypto miners, data exfiltration, obfuscation
- Environment audits: Scan all your installed packages at once
- Requirements scanning: Check your requirements.txt before deployment
Installation
pip install pip-check-safety
Usage
Check a package before installing
pip-check requests
Deep scan (downloads and analyzes source code)
pip-check --deep some-package
Audit all installed packages
pip-check --audit
Check a requirements file
pip-check -r requirements.txt
JSON output for CI/CD
pip-check --json requests
pip-check --audit --json
What it checks
PyPI Metadata
- Package age (brand new packages are higher risk)
- Download count (low downloads = less community vetting)
- Author information
- Source repository presence
Typosquatting
- Levenshtein distance to popular packages
- Common character swaps (0/o, 1/l, rn/m)
- Hyphen/underscore variations
- Suspicious suffixes (-official, -secure, etc.)
Code Patterns (deep scan)
- Dynamic code execution (exec, eval)
- Network exfiltration (socket connections, HTTP requests)
- Obfuscation (base64, marshal, ROT encoding)
- System access (subprocess, os.system)
- Credential theft patterns
- Crypto mining indicators
- Persistence mechanisms
Exit Codes
0- No issues or low risk only1- Medium risk findings2- High risk findings3- Critical risk findings
Use exit codes in CI/CD pipelines:
pip-check --audit
if [ $? -ge 2 ]; then
echo "High-risk packages detected!"
exit 1
fi
Python API
from pip_check import PyPIChecker, TyposquatDetector, CodeScanner, EnvironmentAuditor
# Check a single package
checker = PyPIChecker()
report = checker.check("requests")
report.print_report()
# Detect typosquatting
detector = TyposquatDetector()
report = detector.check("reqeusts") # typo
print(report.findings)
# Scan installed package code
scanner = CodeScanner()
report = scanner.scan_installed("some-package")
# Audit entire environment
auditor = EnvironmentAuditor(deep_scan=True)
reports = auditor.audit_all()
auditor.print_summary(reports)
Support
If this tool helped you, consider supporting:
License
MIT
Metadata
Release files for pip-check-safety 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pip_check_safety-1.0.1.tar.gz | 15.5 kB | Without provenance | Details for pip_check_safety-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pip_check_safety-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pip_check_safety-1.0.1-py3-none-any.whl |
Total release size: 32.2 kB
Release files / pip_check_safety-1.0.1.tar.gz
| Download URL | pip_check_safety-1.0.1.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8a962d5c69c31967b4e4901e70852b565bda6cb73f34260a0aa38cd0e3c9bff
|
|
BLAKE2b-256 checksum How to use checksums |
ab880c72f36bb6b64d64d1a8acf5223b4c98ccb3bd6e07dc67502065e1538df6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pip_check_safety-1.0.1-py3-none-any.whl
| Download URL | pip_check_safety-1.0.1-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5b42be9aa205ab61698d78d1fd22857e609928a7fdc2bca34e7e0f3b8a4df6c
|
|
BLAKE2b-256 checksum How to use checksums |
e24ad5376b198ce542ed28da7ff57d095d8bfe277e21e055900b20a8fd3c099b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for pip-check-safety 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.