← Back to blog
·The mirago teamSecurityPython

Securing Your Python Supply Chain Against AI-Generated Dependencies

AI assistants are now a major source of new dependencies. Here's how to harden your Python supply chain against the risks they introduce.

Your dependencies are only as trustworthy as the weakest one — and in 2026, a growing share of new dependencies arrive via AI assistants rather than deliberate human choice. That changes your supply-chain threat model.

The new entry point

Historically you added a dependency because you researched it. Now an AI suggests import something, you install it to make the code run, and a package you never evaluated is in your tree. Slopsquatting targets exactly this moment.

A layered defence

No single tool is enough. Stack these:

1. Verify imports exist (and aren't suspicious)

Before installing, confirm each package is real and not a brand-new, barely-downloaded copycat. Run mirago:

```bash
mirago check .
```

2. Pin and lock

Use a lockfile so the exact versions you reviewed are the ones that get installed. mirago treats a package already in your lockfile as trusted — it never warns about your declared dependencies.

3. Scan installed packages

mirago checks code before install; tools like pip-audit and OSV-Scanner check what's already installed for known vulnerabilities. Use both — they cover different moments.

4. Enforce it in CI

A check you have to remember is a check you'll skip. Put mirago check . in your pipeline so a fake import fails the build — see Adding mirago to CI.

5. Least privilege at install time

Install in isolated environments; don't run pip install as root; review what build scripts do.

The shift in mindset

Treat every AI-suggested dependency as unverified by default. The goal isn't to distrust AI — it's to add a cheap, automatic verification step at the exact point where trust used to come from human judgement.