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

Disallow anonymous crate browsing in the frontend #164

Merged
merged 1 commit into from
Jun 25, 2023

Conversation

Hirevo
Copy link
Owner

@Hirevo Hirevo commented Jun 7, 2023

Many users expressed the interest in restricting the anonymous browsing of the registry's crates, in the effort of allowing a truly private (in the privacy sense) crate registry.

This PR adds a new boolean configuration option called login_required, which, if enabled, prevents unauthenticated users from browsing the registry using the frontend's pages.

This, however, still does not make the registry completely opaque to anonymous users by itself, due to some of Cargo's APIs not supporting authentication as of yet.

Cargo sends no token to these endpoints so we can't really require one, like:

  • the crate search endpoint (/api/v1/crates?<q>), used by cargo search, which can be used to list all crates in the registry.
  • or the crate download endpoint (/api/v1/crates/:crate/:version/download), used by cargo fetch, which can be used to download any crate in the registry.

(I talk about this situation in more depth in this issue comment, if you wonder why is it like that and what is currently planned to be done about it by the Cargo team)

So, as of today, the definitive way of preventing every kind of anonymous browsing would still be to host the registry in a private network, and require the use of VPN or a proxy (like an SSH tunnel) to access it.

feat(frontend): added `login_required` configuration option
@Hirevo Hirevo added C-enhancement Category: Enhancement P-medium Priority: Medium M-frontend Module: Frontend labels Jun 7, 2023
@Hirevo Hirevo self-assigned this Jun 7, 2023
@Hirevo Hirevo merged commit 24c69c4 into master Jun 25, 2023
@Hirevo Hirevo deleted the feat/private-registry branch August 19, 2023 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement M-frontend Module: Frontend P-medium Priority: Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant