uv/docs
Zanie Blue f84faf726a Make uv’s first-index strategy more secure by default by failing early on authentication failure (#12805)
uv’s default index strategy was designed with dependency confusion
attacks in mind. [According to the
docs](https://docs.astral.sh/uv/configuration/indexes/#searching-across-multiple-indexes),
“if a package exists on an internal index, it should always be installed
from the internal index, and never from PyPI”. Unfortunately, this is
not true in the case where authentication fails on that internal index.
In that case, uv will simply try the next index (even on the
`first-index` strategy). This means that uv is not secure by default in
this common scenario.

This PR causes uv to stop searching for a package if it encounters an
authentication failure at an index. It is possible to opt out of this
behavior for an index with a new `pyproject.toml` option
`ignore-error-codes`. For example:

```
[[tool.uv.index]]
name = "my-index"
url = "<index-url>"
ignore-error-codes = [401, 403]
```

This will also enable users to handle idiosyncratic registries in a more
fine-grained way. For example, PyTorch registries return a 403 when a
package is not found. In this PR, we special-case PyTorch registries to
ignore 403s, but users can use `ignore-error-codes` to handle similar
behaviors if they encounter them on internal registries.

Depends on #12651

Closes #9429
Closes #12362
2025-04-29 16:37:00 -05:00
..
.overrides Add `last updated` for document (#11164) 2025-02-03 22:28:47 -05:00
assets Add static assets to docs pages (#6951) 2024-09-02 20:00:30 -04:00
concepts Bump version to 0.6.15 (#13034) 2025-04-22 00:03:33 +00:00
configuration Make uv’s first-index strategy more secure by default by failing early on authentication failure (#12805) 2025-04-29 16:37:00 -05:00
getting-started [docs] Changed fish completions append >> to overwrite > (#13130) 2025-04-27 20:52:14 -04:00
guides Add ROCm example to the PyTorch guide (#13200) 2025-04-29 15:13:13 -04:00
js Fix typo in a reference (#12858) 2025-04-14 10:19:02 +02:00
pip Fix mismatched pip interface header / nav titles (#12640) 2025-04-08 17:44:44 -05:00
reference Remove --version from subcommands (#13108) 2025-04-29 16:37:00 -05:00
stylesheets Remove the last edited date from documentation pages (#11753) 2025-02-24 13:27:00 -06:00
.gitignore Add structured documentation (#4426) 2024-06-26 11:28:42 -05:00
index.md Fix windows installation instructions mismatch (#11380) 2025-02-10 21:42:50 +01:00
requirements-insiders.in Reference the root requirements from the insiders requirements file (#5105) 2024-07-16 09:51:16 -05:00
requirements-insiders.txt Move content from the mkdocs.public.yml into the template (#11246) 2025-02-05 16:13:46 +00:00
requirements.in Add `last updated` for document (#11164) 2025-02-03 22:28:47 -05:00
requirements.txt Add `last updated` for document (#11164) 2025-02-03 22:28:47 -05:00