Skip to content
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 #15118

Closed
seschall opened this issue Jan 28, 2025 · 1 comment
Closed
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@seschall
Copy link

seschall commented Jan 28, 2025

Problem

Please reopen and fix issue #13574

Currently, cargo will always send an unauthenticated request to a private registry to initially fetch the config.json. However, there is no deterministic behavior how a private registry respond to an unauthenticated request. Artifactory respond sometimes with a 403 error. Other systems may respond with a 404 to avoid revealing to unauthenticated users that the page exists.

Problem: security

Current workarounds go in the direction to lower the security of a private registry by allowing anonymous access.

Problem: usability

  1. For me as a user it is very difficult to unterstand why I get these error messages even though I am using correct credentials.
  2. If I am not able change the behavior of the registry I must download the config.json and place it into the cache manually.

Steps

see issue 13574

Possible Solution(s)

Don't send unauthenticated requests when authentication is already configured for a private repository.

Notes

No response

Version

cargo 1.82.0
release: 1.82.0
host: aarch64-apple-darwin
libgit2: 1.8.3 (sys:0.19.0 system)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 14.7.2 [64-bit]
@seschall seschall added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jan 28, 2025
@arlosi
Copy link
Contributor

arlosi commented Feb 3, 2025

However, there is no deterministic behavior how a private registry respond to an unauthenticated request

This would be a bug in the private registry implementation, not Cargo. The Cargo sparse registry protocol requires private registries to respond with HTTP 401 if authentication is required.

If the registry wishes to prevent users from determining whether a name exists or not, it should respond with HTTP 401 for all registry names, regardless of whether they exist or not.

@arlosi arlosi closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants