See what a package runs before you install it.

Buckthorn is a static checker for Python and npm packages. It reads the wheel, sdist or tarball, and tells you whether installing it, starting Python or importing it would run code. Nothing is installed, imported or run.

Installing a package is running it.

pip install runs setup.py. A .pth file in a wheel runs every time Python starts. import runs whatever the package's __init__.py says. A malicious package needs no exploit. It only needs you to install it.

Buckthorn reads that code first, straight from the archive, and tells you what it would do.

$ buckthorn scan colourful_logs-1.4.2-py3-none-any.whl
colourful_logs-1.4.2-py3-none-any.whl: flagged
  high     BKT-HIDE-001     colourful_logs/__init__.py:2  exec of data decoded by base64.b64decode
  medium   BKT-PTH-001      colourful_logs-1.4.2.pth:1  .pth line runs code at every Python start

1 scanned: 1 flagged

Check the code where it comes in.

01

Your agent's MCP config

An agent starts every server in .mcp.json with your credentials, and uvx some-server runs whatever was released that day. buckthorn check .mcp.json fetches the release each server would start and reads it first.

02

Upgrades

buckthorn diff requests==2.32.3 requests==2.32.4 shows only what the new version adds. If a maintainer account is taken over, the new code is in that diff.

03

A quiet CI gate

buckthorn check uv.lock fetches every pinned file, checks its hash and reads it, before anything is installed. Accept what is there today with --write-allowlist, and from then on only new behaviour fails the build.

04

npm and model repos, in preview

npm tarballs, and the code a Hugging Face repo runs with trust_remote_code=True. Newer than the Python side, and called preview until we have measured them on packages they have never seen.

Quiet on packages it has never seen.

We tested Buckthorn next to GuardDog on 5,723 benign files and 430 malicious archives that none of its rules had seen. The plan was committed before the first scan, so the numbers could not be tuned after the fact.

Benign files flagged, 5,723 files

Buckthorn
5.4%
GuardDog
23.7%

Projects flagged, PyPI ranks 1,001 to 3,000

Buckthorn
8.8%
GuardDog
24.7%

Projects flagged, 1,000 recently updated projects

Buckthorn
5.4%
GuardDog
35.0%

That is about a quarter of the false alarms. And it held up: on the top 1,000 packages we tuned on, Buckthorn flagged 6.9% of files. On packages it had never seen, 5.4%.

When it flags, it is usually right about what it saw. Of 50 flags we checked by hand, 42 were the package really doing what the rule describes, like a .pth file that runs at start-up. It also finished every file, with no errors or timeouts.

Better together. The two tools see different things. Buckthorn caught 26 malicious archives that GuardDog's threat rules missed. Run both, and 74.7% of the malicious set is caught, against 68.6% for GuardDog alone.

On its own, GuardDog catches more of the malware. Buckthorn reads what runs at install, at start-up and at import, and leaves code you call yourself to other tools. We believe the gate in front of every install has to be quiet first, because a noisy gate gets switched off.

Self-measured. GuardDog 3.2.0, threat rules, run offline, so its metadata rules did not run. Buckthorn at commit c80b090, from before the fixes in 0.1. The full write-up has 95% intervals, the protocol and every result.

Read the archive. Don't run it.

01

Nothing is executed

Archives are read in memory, with limits on how many files and how many bytes. No pip install, no setup.py egg_info, no build backend call. Code is parsed, never imported or run.

02

What pip really runs

In setup.py, only the commands pip runs count as install code. A publish shortcut that never runs at install is a note, not an alarm. When it cannot be sure, it counts the whole file.

03

Hiding is a finding

exec of base64-decoded data, and builtins reached through getattr with a name built at run time. A package that hides its code is flagged for the hiding alone.

04

Coverage is a finding

A file it could not read is not_verified, never clean. A package cannot buy a clean verdict with a file Buckthorn gives up on.

Fits where packages come in.

pipx install buckthorn
buckthorn check uv.lock
Command lineWheels, sdists, npm tarballs and installed environments. Text, JSON or SARIF.
Lockfilesrequirements.txt with hashes, uv.lock and poetry.lock, each file hash-checked.
GitHub ActionFails the build on a finding and uploads SARIF to code scanning.
Pre-commitRuns whenever a lockfile changes.
Coding agentsAn MCP server with three read-only tools your agent can call before it installs.
Scan receiptsAn in-toto statement of what was checked, by hash, that GitHub can sign.
- uses: hedgerow-dev/buckthorn@v0.1.0
  with:
    lockfile: uv.lock

One dependency. Hash-checked fetches.

Buckthorn needs Python 3.11 or newer and one dependency, packaging. scan makes no network calls. check and diff fetch only from PyPI over https, and check each file's sha256 before reading it. MIT licensed. The most useful thing you can send us is a package it gets wrong.