Repository navigation
Conversation
The Cargo me, publish, yank and download views now try the Cargo token first, then the instance's default authentication classes, so clients can use the credentials the deployment is configured for (e.g. HTTP Basic) as well as `cargo login` tokens. Token scope checks only apply when the request is authenticated with a Cargo token. Add a cargo_auth_required boolean on the Rust distribution and use it for auth-required in the index config. The setting only controls whether Cargo sends its credential on index and download requests; it does not restrict access by itself. Assisted By: Claude Opus 5.5 Co-authored-by: baptiste <BaptisteCentreon@users.noreply.github.com>
When cargo_auth_required is set on a distribution, the index config.json, the sparse index files and the download endpoint now require the rust.view_rustdistribution permission on the distribution. Anonymous requests get a 401 with a "WWW-Authenticate: Cargo" challenge, so Cargo retries with its credential. A Cargo token scoped to other distributions cannot read this one. The index views now accept the same credentials as the other Cargo endpoints: the Cargo token first, then the instance's default authentication classes. The download endpoint redirects to the content app, which this does not cover; a content guard is still needed to protect the crate files. Assisted By: Claude Opus 5.5
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Checklist
Follow-up of #61, as discussed there: when
cargo_auth_requiredis set, the registry is now private.config.json, the sparse index and the download endpoint requirerust.view_rustdistributionon the distribution (e.g. therust.rustdistribution_viewerrole).401withWWW-Authenticate: Cargo, so Cargo retries with its credential; authenticated users without the permission get a403..cratefiles still need a content guard. Happy to discuss how to handle that in a separate PR.This branch is based on #61 and includes its commit until it merges; only the last commit is new.
See: Pull Request Walkthrough