A defensive pip wrapper with supply-chain preflight checks.
Project description
Not Finished Yet. Contribution Welcome. Site at https://spip.lamentxu.top/
secured_pip
An open-source, free guard for your pip to avoid supply-chain attacks.
By using this, you can avoid being screwed by the poisoned LiteLLM, etc. just because you type pip install
What?
Currently, supply chain attacks are one of the major security concerns all over the world. The secured_pip project is a future pip wrapper focused on supply-chain risk controls.
Wait, What?
You can use
spip install requests
Instead of
pip install requests
To install a package more safely in the scope of supply chain security.
You do not need to configure. You do not need to learn. Just pure install-to-master.
In other words, you can completely replace pip install with spip install to make your installation safer :)
If you want a near drop-in experience, you can set a shell alias from pip to spip.
Command Prompt (Windows):
doskey pip=spip $*
Bash (Linux):
echo "alias pip='spip'" >> ~/.bashrc
source ~/.bashrc
Zsh (macOS):
echo "alias pip='spip'" >> ~/.zshrc
source ~/.zshrc
The secured_pip project will actively check for all the supply chain risks and avoid you installing potentially malicious packages when typing spip install
For install, spip uses pip's own resolver and then checks the selected install plan before pip builds or installs the resolved distributions. If the checks pass, the same pip install flow continues; spip does not run a second pip install for the already-resolved packages.
Except for the install commands, the project behaves exactly the same as the original pip program. That is, you can always use spip instead of pip in any case :)
If you want to refresh local caches used by spip, run:
spip refresh-cache
Why not SFW / GuardDog?
There are already good supply-chain tools out there. secured_pip is not trying to replace all of them. The point is different: keep the protection path as light as possible for everyday Python installs.
- Compared with Socket Firewall (
sfw): Socket Firewall works as a wrapper/proxy layer in front of package-manager network requests and uses Socket's security intelligence to block packages before download.secured_pipis much smaller in scope: it is a local Python-onlypipwrapper, with no proxy service, no organization dashboard, and no extra infrastructure to run. Official Socket docs: https://docs.socket.dev/docs/socket-firewall-overview - Compared with GuardDog: GuardDog is a scanning CLI that downloads package source archives and applies source-code and metadata heuristics, including Semgrep-based rules.
secured_pipis intentionally lighter: it stays close topip install, does quick local checks around the install flow, and does not try to be a full package-code scanner. Official GuardDog README: https://github.com/DataDog/guarddog
In short, secured_pip optimizes for:
- near-drop-in use with
spip install - local, lightweight checks
- minimal workflow change
- Python / pip focus instead of broad multi-ecosystem coverage
Current minimum Python version: 3.10
We currently have three install warning policies:
HIGH: pause installation and require--ignore-warningMEDIUM: prompty/nbefore continuingLOW: warn and continue
The default sensitivity is low, which uses the policy above. You can make
the gate stricter with --sensitivity medium or --sensitivity high:
--sensitivity medium:MEDIUMand above pause installation;LOWprompts.--sensitivity high:LOWand above pause installation.
When spip detects a potential risk, a warning will be raised, with the level depending on the severity the risk is.
For now, the project has several major check points:
- Fake typo checks: Hackers often use "fake typos" to inject a malicious dependency package into the poisoned source file.
spipdetects this by first resolving all the packages thatpip installis going to download, and then comparing non-popular resolved package names with a local hot-package list. Warning levels:- Medium severity:
requsetsvsrequests - Medium severity:
pandazvspandas - Low severity:
sixthvssix
- Medium severity:
- Direct URL dependency checks: If the install target or a resolved dependency uses a direct URL, VCS URL, or PEP 508 direct reference,
spipwill raise aMEDIUMwarning. - Fresh release checks: If the selected PyPI release was published less than 2 days ago,
spipwill raise aMEDIUMwarning. - Disposable email checks: If the PyPI release metadata uses a known disposable author or maintainer email domain,
spipwill raise aLOWwarning. The built-in blocklist is vendored fromdisposable/disposable-email-domainsstrict mode. - Empty description checks: If the selected PyPI release metadata has no summary and no long description,
spipwill raise aLOWwarning. - Suspicious metadata URL checks: If PyPI metadata points to a shortener, raw IP, suspicious TLD, embedded credentials, or similar suspicious URL,
spipwill raise aLOWwarning. - Repository mismatch checks: If PyPI metadata points to a GitHub/GitLab repository whose repo name appears unrelated to the package name,
spipwill raise aLOWwarning. - Maintainer email domain drift checks: If a package's maintainer email domain changes compared with the local
spiphistory cache,spipwill raise aLOWwarning. - Zero-version checks: If the selected package version is
0.0or0.0.0,spipwill raise aLOWwarning. -
.pthfile detection: Instead of directly injecting malicious code inside the package, today most hackers will place their bad stuff under a.pthfile, with animportas the beginning.spiponly checks the installed file-system diff after installation. The warning level is alwaysMEDIUM, andspipwill ask whether to delete the suspicious installed.pthfile. - TODO ...
Project details
Release history Release notifications | RSS feed
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 secured_pip-0.4.1.tar.gz.
File metadata
- Download URL: secured_pip-0.4.1.tar.gz
- Upload date:
- Size: 462.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0b2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
261d04b861e8c5c4dea5ce92e5b0d4b628002a305d78b36e0e8040fd1607a848
|
|
| MD5 |
af76803b898f31ba603ab7922b18dcab
|
|
| BLAKE2b-256 |
e9695eb4531d61616d6546f7ebb19783e6fc9af40130d87a7578314f88b93b80
|
File details
Details for the file secured_pip-0.4.1-py3-none-any.whl.
File metadata
- Download URL: secured_pip-0.4.1-py3-none-any.whl
- Upload date:
- Size: 449.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0b2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
193963698fdbeb5f2d172cc54b9b89e03990daaaf8ec88ca10ed2054c79885b7
|
|
| MD5 |
2124630b1214de0929b170eb4a5ee8a2
|
|
| BLAKE2b-256 |
f1f8022e6f31bc9a430101d12c3b42495babb72a46eb493e34e426458fee8e7b
|