uv: `uv pip` resolver should be able to backtrack on 403
Many organisations employ in-band scanner tools on their internal PyPI mirrors, with the aim of preventing the ingress of compromised/non-compliant dependencies. Usually such tools will make their blocking decisions known by way of a HTTP 403 response code at download time.
One of the key pain-points with this approach is that, as new versions of packages come out, they will almost inevitably 403-upon-first-download, as they are yet to be scanned and cleared.
Currently the resolver completely gives up when encountering a 403 code, perhaps on the assumption that this is the usual ‘permission denied’ meaning, as opposed to a more granular ‘not this one, please’ meaning. This behaviour is not unique to uv; pip also does this, but uv probably hits this worse than pip thanks to supporting universal resolution etc. Regardless, it is a pretty substantial negative impact to developer experience.
I think there should be a resolver option to allow backtracking when 403 codes are encountered, so that older (but scanned + cleared) versions will be considered.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 18 (15 by maintainers)
I think the request is is not to retry the request but to try another package version. I think if don’t get a 403 when listing packages, it’s reasonable for us to try another version after a 403 for a specific archive.
Hmm, unfortunately that’s not a common practice for us so it would take some work. Maybe I can just ship it and we test against the released binary.
@paveldikov – I want to help you with this, since I get the sense it’s causing a lot of trouble. In your index, is this happening when we go to fetch the metadata for the distribution?
Just to give an example for the question by notatallshaw
I’ve run into it with Sonatype Nexus in combination with Repository Firewall. The symptoms are just as paveldikov reported - the packages are visible and exist, but access is blocked when it comes to pulling the wheels
https://help.sonatype.com/en/firewall-quarantine.html#firewall-quarantine