Skip to main content

System-wide pip install audit logger with OSV vulnerability scanning

Project description

PyPI version PyPI - Python Version License

rönti

System-wide pip install audit logger with OSV vulnerability scanning. Intercepts every pip install, logs it to a local SQLite database, and alerts on known vulnerabilities at install time.

Purpose

rönti is a personal tool I developed in response to recent supply chain attacks (Shai-Hulud / TeamPCP campaigns) of the open source ecosystem as a part of a large-scale worming attack. While CI/CD and production environments already implement various security scanners, developer and individual machines rarely bother with setting up such an extensive suite of tools, and I have not found a tool that does this cleanly/automatically for developers, even if scripts do exist.

rönti hooks into every pip install and does an automatic precheck and post install check for the package and its dependencies, querying the osv.dev CVE database. This way it is possible to automate at the install level easy automatic vetting and notification of a user about CVEs they might have otherwise not known.

I forecast that with the increased role of AI assistance in both finding CVEs defensively and creating them offensively, the number of CVEs discovered will be increasingly hard to keep up with manually.

Limitations

I will provide only an implementation for python/pip, and eventually AUR support too. I do not have plans to create or maintain versions for other distros or languages. uv support may come in the future.

Install

rönti must be installed system-wide (into /usr/local/bin) so that sudo can find it and the pip shim is on everyone's PATH:

sudo pip install ronti --break-system-packages
sudo ronti setup

setup is interactive — it will ask before touching your group membership and offer to switch your session immediately. It is safe to re-run; all steps are idempotent.

Non-interactive / CI / Docker:

sudo pip install ronti --break-system-packages
sudo ronti setup --non-interactive

--non-interactive is also activated automatically when there is no TTY (piped install, CI pipeline, Docker build).

What setup does

Step Detail
Creates ronti group Shared write access to the audit DB
Creates /var/lib/ronti/ root:ronti 2775 — new files inherit group
Initialises audit.db root:ronti 660 — only group members read/write
Installs pip shim Backs up real pip to .pip-real, drops shim at /usr/local/bin/pip and pip3
Sets RONTI_DB Appended to /etc/environment for all users
Adds you to ronti group Optional — prompted interactively

Source install

git clone https://github.com/ieeprizy/ronti
sudo bash ronti/ronti/setup.sh

Per-venv hook

[!IMPORTANT] The pip shim only covers the system pip. To also log installs inside a specific venv:

ronti inject-venv /path/to/.venv

How it works

Once the shim is active, every pip install is intercepted automatically — no need to run ronti scan for new packages. The shim:

  1. Pre-install: queries OSV for any pinned (==) packages before pip runs, warning if a vulnerable version is about to be installed.
  2. Runs pip as normal.
  3. Post-install: logs the install (package, version, user, cwd, git context, dep tree) to the SQLite database, then batch-queries OSV for the full transitive dependency tree.

ronti scan and ronti osv-scan are for retrospective checks of the install history database.

Usage

# List recent installs (all users)
ronti list
ronti list requests            # filter by package name

# Scan history against your local advisory database
ronti scan
ronti scan --osv               # also query OSV (requires network)
ronti scan --fail              # exit 1 if any hits (CI gate)

# OSV scan of all recorded installs
ronti osv-scan
ronti osv-scan --fail

# Dependency tree recorded at install time
ronti tree requests

# Version history for a package
ronti diff requests

# Installs grouped by git repo
ronti repos

# Advisory database (user-managed, in addition to live OSV)
ronti advisory list
ronti advisory add <package> --version 1.2.3 --severity critical --description "..."

# Inject hook into a specific venv
ronti inject-venv /path/to/.venv

Docker

Use the CLI docker-scan subcommand in your Dockerfile:

RUN pip install ronti --break-system-packages
RUN pip install -r requirements.txt && ronti docker-scan -r requirements.txt

Or copy the zero-dependency standalone script (ronti/docker_scan.py) if you do not want rönti in the image at all:

COPY ronti/docker_scan.py /usr/local/bin/ronti-docker-scan
RUN pip install -r requirements.txt && \
    python /usr/local/bin/ronti-docker-scan -r requirements.txt

Exit 0 = clean. Exit 1 = vulnerability found (fails the build). Use --warn-only to log without failing the build. Use --json for machine-readable output. Use --no-osv for air-gapped builds.

Environment variables

Variable Default Description
RONTI_DB /var/lib/ronti/audit.db Path to SQLite database
RONTI_DISABLE unset Set to 1 to bypass the shim entirely
RONTI_DEBUG unset Set to 1 for verbose shim/OSV output

Schema

installs  — one row per pip install invocation
  id, ts, package, version, wheel_hash,
  installer, invoked_by, cwd, argv,
  venv_path, site_packages,
  git_remote, git_branch,
  uid, username

deps      — dependency tree recorded at install time
  install_id → installs.id
  dep_name, dep_version, dep_extras

advisories — user-managed known-bad packages (OSV is the primary source)
  package, bad_version (NULL = any version), severity,
  description, cve, added_ts

osv_cache  — (package, version) → vuln IDs, 6 h TTL
osv_vulns  — vuln ID → full record, no expiry

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ronti-0.1.2.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ronti-0.1.2-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file ronti-0.1.2.tar.gz.

File metadata

  • Download URL: ronti-0.1.2.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for ronti-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ca8af0175e4368050c0da1794caef5c6b245394d6ac30976c9bb7f5fadb30234
MD5 999090e8e3b25fff7b0b536351448740
BLAKE2b-256 a57925484ac093d48504dec67a26e02d999b8fe25cacf2f741508b6387058343

See more details on using hashes here.

File details

Details for the file ronti-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ronti-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for ronti-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f156e6aa6a6938ccfa01db0eeb11732bce0aacd9d4df6f730be1f774754b01e
MD5 27be807bfff2448618e1b19b02f36bb0
BLAKE2b-256 7174ce830ca0ed2c407ff82a02ac06cfb19fd43857cc0cf97996aecd936aa5b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page