# uv Wants to Secure Your CLI Tools

Tools like Ruff, pre-commit, and httpie sit on a developer's machine for months. Your project dependencies get lockfiles and vulnerability scans, but these globally installed CLI tools have no recorded resolution at all. [uv](https://pydevtools.com/handbook/reference/uv.md) is working to change that. A [preview feature](https://github.com/astral-sh/uv/blob/main/CHANGELOG.md#01125) in 0.11.25 starts by writing a [`uv.lock`](https://pydevtools.com/handbook/explanation/what-is-a-lock-file.md) for each tool you install, laying the groundwork for a future `uv tool audit` command.

## How to enable it

Pass the `tool-install-locks` preview flag to `uv tool install`:

```console
$ uv tool install --preview-features tool-install-locks pyfiglet
 + pyfiglet==1.0.4
Installed 1 executable: pyfiglet
```

uv writes a `uv.lock` next to the tool's `uv-receipt.toml`, recording the full resolution with hashes. `uv tool upgrade` updates the lock, so it stays current as tools move. Without the flag, behavior is unchanged.

## Why this matters

The lock gives you two things. Reproducibility: the same install on another machine resolves to the same versions instead of drifting. And security: because the lock records a hash for every distribution, uv rejects a wheel whose contents don't match, blocking a swapped-artifact attack. Astral described this threat model when it [shipped uv's malware checks](https://astral.sh/blog/uv-audit). [pipx](https://pydevtools.com/handbook/explanation/how-do-uv-tool-and-pipx-compare.md) still writes no resolution record at all.

The next step, tracked in [issue #19886](https://github.com/astral-sh/uv/issues/19886), is a `uv tool audit` command that reads these per-tool locks and checks them against the OSV vulnerability database. That command hasn't landed yet. In the meantime, you can already scan a uv project or requirements file with [`uv audit`](https://pydevtools.com/handbook/how-to/how-to-scan-python-dependencies-for-vulnerabilities.md).

> [!WARNING]
> `tool-install-locks` is a preview feature. The flag name, lock placement, and eventual audit interface may change before they stabilize. Track the [uv changelog](https://github.com/astral-sh/uv/blob/main/CHANGELOG.md) for updates.

## Learn more

- [How to Scan Python Dependencies for Vulnerabilities](https://pydevtools.com/handbook/how-to/how-to-scan-python-dependencies-for-vulnerabilities.md)
- [How to Protect Against Python Supply Chain Attacks with uv](https://pydevtools.com/handbook/how-to/how-to-protect-against-python-supply-chain-attacks-with-uv.md)
- [How do uv tool and pipx compare?](https://pydevtools.com/handbook/explanation/how-do-uv-tool-and-pipx-compare.md)
- [What is a lock file?](https://pydevtools.com/handbook/explanation/what-is-a-lock-file.md)
- [uv reference](https://pydevtools.com/handbook/reference/uv.md)
