-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send authentication credentials to private registry to fetch config.json #13574
Comments
For anyone seeing this issue in the future there are three workarounds:
|
@cpaika I would like to solve this bug |
@rohansx wroth noting that this one doesn't have |
@weihanglo Oh i see.. thanks for clarifying! |
@arlosi you might be interested in this |
Cargo already caches the Since the request is unauthenticated, it shouldn't be possible to link it to a specific user account to rate-limit.
I'm going to close this since it seems like an Artifactory issue. If Cargo is observed sending more than one uncached, unauthenticated request, please re-open. cc @nadav-y |
IIRC the username is required in the URL in order to request the config.json at all, which then creates the lock-out problem. Agreed this is an Artifactory issue since this behavior opens them up to DOS, if they allowed complete anonymous download of just the |
Problem
Currently, cargo will always send an unauthenticated request to a private registry to initially fetch the config.json. When it receives a 401, it will then retry fetching the config.json including the authentication headers the second time.
However Artifactory (a common private registry) will rate limit users based on a 401 - so in my case, if we have two jobs running with the same user, and they both fetch the config.json, and both receive a 401 - that user will be rate limited in Artifactory due to too many 401's, which then causes further Artifactory cargo fetches to fail.
Steps
cargo build
running simultaneously:seq inf | xargs -n1 -P10 -I{} curl "https://username@private-registry.com/index/config.json"
You will observe 401's, and then 403's as your user is rate limited.
Possible Solution(s)
Users have authentication setup for private registry already - can there be a flag in your authentication to always send the auth header while fetching the
config.json
? That way you can avoid triggering 401's and user lockout. This also improves the user experience, since we're not wasting a round trip on a 401 when auth is already configured for a private repository.Notes
No response
Version
The text was updated successfully, but these errors were encountered: