installtime-audit
Audit Python packaging files for install-time side effects — code that runs
during pip install and that malicious packages abuse to phone home, steal
credentials, or establish persistence. It's the supply-chain gap Bandit doesn't
specifically target.
Code at module scope in setup.py (and build.py, hatch_build.py, …), or
inside a build hook like setup() / install.run(), executes on install.
installtime-audit statically flags dangerous operations reachable at that
point — without importing or running any of the target code.
Install
pip install installtime-audit
What it flags
| Rule | CWE | Kind | Pattern |
|---|---|---|---|
INSTALL-NET |
829 | warning | network fetch/connect during install |
INSTALL-EXEC |
78 | vuln | subprocess / os.system during install |
INSTALL-DYNAMIC-EXEC |
94 | vuln | exec() / eval() during install |
INSTALL-OBFUSCATED-EXEC |
506 | vuln | exec() on a base64/marshal-decoded payload |
INSTALL-NET-EXEC |
494 | vuln | network + execution both reachable (download-and-run) |
INSTALL-CREDS-ENV |
522 | warning | reads a sensitive env var (PYPI_TOKEN, AWS_*, …) |
INSTALL-CREDS-FILE |
522 | vuln | opens ~/.aws/credentials, ~/.pypirc, ~/.ssh/id_rsa, … |
INSTALL-PERSISTENCE |
506 | vuln | writes to autostart / cron / shell-rc paths |
DEPCONF-EXTRA-INDEX |
829 | warning | --extra-index-url (dependency confusion) |
DEPCONF-TRUSTED-HOST |
295 | warning | --trusted-host disables TLS verification |
DEPCONF-DEP-LINKS |
829 | warning | dependency_links fetches from arbitrary URLs |
DEPCONF-DIRECT-URL |
829 | warning | @ https://... direct-URL dependency in pyproject |
Helper functions that the build system never calls are not flagged, to keep noise low — only module scope and known hooks count as reachable.
Library usage
from installtime_audit import scan_source, scan_path
for f in scan_source(open("setup.py").read(), filename="setup.py"):
print(f) # setup.py:12: [vuln] INSTALL-NET-EXEC (494) ...
# Or scan a whole unpacked package
findings = scan_path("./unpacked_package/")
CLI
installtime-audit ./unpacked_package/
installtime-audit setup.py requirements.txt --json
Exit code is non-zero when a vuln-kind finding exists (tune with --fail-on any|vuln|never), so it drops into CI easily.
Caveats
This is a heuristic linter for triage, not proof of maliciousness. Legitimate packages sometimes compile extensions or fetch data at build time; review each finding in context.
License
MIT
Metadata
Release files for installtime-audit 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| installtime_audit-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for installtime_audit-0.1.0-py3-none-any.whl |
Release files / installtime_audit-0.1.0-py3-none-any.whl
| Download URL | installtime_audit-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39c7f72f5cb74c14f4ba54a6974dbb371f7fc05c994978ef180f2df5bc1463fc
|
|
BLAKE2b-256 checksum How to use checksums |
c6df9434d1f6ca4ea140323f603144da1d5e942696654f31dcf6244d0d2d7a97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Security for installtime-audit 0.1.0
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.