Python and npm supply-chain lockdown kit: LiteLLM 1.107.0 check and an unpinned-install hook

A read-only script that checks a machine for the LiteLLM 1.107.0 indicators, plus a Claude Code hook that blocks unpinned pip and npm installs. Tested.

· By Derrick K.

Hand holding a brass padlock
Photo by Nathan Thomas on Pexels
Free account required

On Oct 21, 2026, LiteLLM said version 1.107.0 on PyPI was malicious. This kit checks your machines for it and stops your coding agent from pulling an unpinned package next time. Background: LiteLLM 1.107.0 was compromised: how to check your machines.

Preview: check_litellm_1_107_0.py

# Run with -S so .pth files and sitecustomize.py are not loaded
python3 -S -I scripts/check_litellm_1_107_0.py ~/code ~/venvs --docker

# Exit codes: 0 = no indicators, 1 = indicators found, 3 = run without -S

It checks for litellm-1.107.0.dist-info, cook.pth, cook.py, an unexpected sitecustomize.py, their __pycache__ copies, the /tmp/remote_code_loader.lock lock file and, with --docker, local images whose digests start with the prefixes in the incident post.

What's inside

  • scripts/check_litellm_1_107_0.py: the read-only indicator check
  • .claude/hooks/block-unpinned-installs.py: blocks pip install litellm, allows pip install litellm==1.106.2
  • .claude/settings.json: registers the hook for the Bash tool
  • .npmrc: save-exact=true, so npm saves 1.2.3 instead of ^1.2.3
  • tests/test_kit.py: 19 blocked and 20 allowed commands, plus scanner tests on clean and fake infected folders
  • README.md: setup and limits

How to use it

  1. Unzip the kit.
  2. Run python3 -S -I scripts/check_litellm_1_107_0.py with the folders that hold your projects and virtualenvs.
  3. Copy .claude/ into your project root. Merge the hooks key if you already have a settings file.
  4. Type /hooks in Claude Code to check the hook is listed.
  5. Test it: ask Claude to run pip install litellm. It should be blocked.
  6. Optional: run python3 -m unittest discover -s tests -v.

Who it's for

Anyone who had LiteLLM in a project, and anyone who lets a coding agent install packages.

FAQ

Does the script clean an infected machine?

No. It only reads. If it finds indicators, follow the cleanup order in LiteLLM's incident post, then rotate your secrets.

Why does it need python3 -S?

The malware loads from a .pth file when Python starts. -S tells Python to skip site processing, so the check doesn't trigger the thing it's looking for.

Does the hook block npm install with no package name?

No. Bare npm install, pnpm install and npm ci install from your lockfile, so they're allowed. So is pip install -r requirements.txt, so pin that file too.

Can an agent get around the hook?

Yes, with a creative rewrite. It's a safety net, not a sandbox. It doesn't cover npx, uvx or curl | sh.

Keep reading

Keep reading

Newsletter

The Codema publication. Consent is required. You are not subscribed until you confirm from the email, and nothing is stored if email delivery is not connected.