Skip to content

Catching malware before install 🦠

uv now ships a built-in security scanner. It's still an experimental feature, so it needs to be opted into explicitly:

uv audit --preview-features audit-command

It checks your dependencies against known vulnerability databases, flagging CVEs and deprecation.

Malware detection is a separate, opt-in preview feature too:

UV_MALWARE_CHECK=1 uv sync --preview-features malware-check

With it set, uv add and uv sync run a lightweight lookup against OSV - an open, community-run vulnerability and malware database for open-source packages - before installing anything, not just at scan time.

Why before matters: when PyPI quarantines a malicious package, it removes it from the index, but uv resolves straight from a lockfile that can point directly at storage objects, potentially bypassing the quarantine. The pre-install OSV check closes that gap.

⚠️ Malware detection only catches what's already been publicly disclosed - a freshly compromised package won't be flagged right away.

🧊 That's where dependency cooldowns come in: delay picking up new package versions for a few days, giving the community time to catch and report anything malicious before it reaches you:

uv sync --exclude-newer 7d

This excludes any dependency versions published in the last 7 days.

📚 Full details in the uv audit announcement.