Skip to content

Comments

Improve 403 Forbidden error message to indicate package may not exist#16353

Merged
konstin merged 2 commits intoastral-sh:mainfrom
aug6th:fix/issue-16340-incorrect-403-error
Oct 20, 2025
Merged

Improve 403 Forbidden error message to indicate package may not exist#16353
konstin merged 2 commits intoastral-sh:mainfrom
aug6th:fix/issue-16340-incorrect-403-error

Conversation

@aug6th
Copy link
Contributor

@aug6th aug6th commented Oct 18, 2025

Fixes #16340

Summary

Some package registries (PyTorch, corporate PyPI mirrors) return 403 Forbidden when a package is not found, instead of 404 Not Found. The previous error message incorrectly suggested this was always an authentication issue, causing confusion for users.

This PR updates the error hint to clarify that a 403 error could indicate either missing authentication credentials OR that the package doesn't exist on the index.

Test Plan

  • Updated existing snapshot test in crates/uv/tests/it/edit.rs to reflect the new error message
  • The change is purely a message improvement with no behavioral changes

Changes

Before

hint: An index URL (https://example.com/simple) could not be queried due to a lack of valid authentication credentials (403 Forbidden).

After

hint: An index URL (https://example.com/simple) returned a 403 Forbidden error. This could indicate missing authentication credentials, or the package may not exist on this index.

Files Changed

  • crates/uv-resolver/src/pubgrub/report.rs - Updated error message
  • crates/uv/tests/it/edit.rs - Updated snapshot test expectation

Fixes astral-sh#16340

Some package registries (PyTorch, corporate PyPI mirrors) return 403
Forbidden when a package is not found, instead of 404 Not Found. The
previous error message incorrectly suggested this was always an
authentication issue.

Updated the hint message to clarify that a 403 error could indicate
either missing authentication credentials OR that the package doesn't
exist on the index.
@konstin konstin added the error messages Messaging when something goes wrong label Oct 20, 2025
@konstin
Copy link
Member

konstin commented Oct 20, 2025

I've changed the message to be consistent with the 401 message and to indicate that credentials may exist, but they may not be valid. (We may improve this further in a follow-up by checking whether credentials were used for this index)

@konstin konstin enabled auto-merge (squash) October 20, 2025 09:41
@konstin konstin merged commit e0fe38e into astral-sh:main Oct 20, 2025
273 of 278 checks passed
@samypr100
Copy link
Collaborator

samypr100 commented Oct 20, 2025

On this avenue of change, artifactory has an option to return 404 instead of 403 to hide existence.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Oct 22, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.3` -> `0.9.5` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.9.5`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#095)

[Compare Source](astral-sh/uv@0.9.4...0.9.5)

Released on 2025-10-21.

This release contains an upgrade to `astral-tokio-tar`, which addresses a vulnerability in tar extraction on malformed archives with mismatching size information between the ustar header and PAX extensions. While the `astral-tokio-tar` advisory has been graded as "high" due its potential broader impact, the *specific* impact to uv is **low** due to a lack of novel attacker capability. Specifically, uv only processes tar archives from source distributions, which already possess the capability for full arbitrary code execution by design, meaning that an attacker gains no additional capabilities through `astral-tokio-tar`.

Regardless, we take the hypothetical risk of parser differentials very seriously. Out of an abundance of caution, we have assigned this upgrade an advisory: <GHSA-w476-p2h3-79g9>

##### Security

- Upgrade `astral-tokio-tar` to 0.5.6 to address a parsing differential ([#&#8203;16387](astral-sh/uv#16387))

##### Enhancements

- Add required environment marker example to hint ([#&#8203;16244](astral-sh/uv#16244))
- Fix typo in MissingTopLevel warning ([#&#8203;16351](astral-sh/uv#16351))
- Improve 403 Forbidden error message to indicate package may not exist ([#&#8203;16353](astral-sh/uv#16353))
- Add a hint on `uv pip install` failure if the `--system` flag is used to select an externally managed interpreter ([#&#8203;16318](astral-sh/uv#16318))

##### Bug fixes

- Fix backtick escaping for PowerShell ([#&#8203;16307](astral-sh/uv#16307))

##### Documentation

- Document metadata consistency expectation ([#&#8203;15683](astral-sh/uv#15683))
- Remove outdated aarch64 musl note ([#&#8203;16385](astral-sh/uv#16385))

### [`v0.9.4`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#094)

[Compare Source](astral-sh/uv@0.9.3...0.9.4)

Released on 2025-10-17.

##### Enhancements

- Add CUDA 13.0 support ([#&#8203;16321](astral-sh/uv#16321))
- Add auto-detection for Intel GPU on Windows ([#&#8203;16280](astral-sh/uv#16280))
- Implement display of RFC 9457 HTTP error contexts ([#&#8203;16199](astral-sh/uv#16199))

##### Bug fixes

- Avoid obfuscating pyx tokens in `uv auth token` output ([#&#8203;16345](astral-sh/uv#16345))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNTEuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE1Mi45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect 403 Forbidden during uvx with non existing package

3 participants