Giter VIP home page Giter VIP logo

Comments (3)

techninja1008 avatar techninja1008 commented on May 18, 2024

@Hirevo I'm willing to contribute code to make this use case possible. Specifically, I'm thinking about two separate features each represented by a default-disabled configuration option:

  • Disable registration
  • Require user to be logged in to access all API endpoints. One thing I'm not sure of here is whether cargo sends a token with search and download requests, as these aren't listed as authenticated in the alternative registries spec.

from alexandrie.

Hirevo avatar Hirevo commented on May 18, 2024

Hello !

Sorry for my long absence about this.
I agree that this is a feature that is indeed desirable to have.
@techninja1008, Thanks for showing interest in helping with this.

In the current state of affairs, it is possible to have the index be private by passing an SSH link to it in Cargo's config.
This makes it impossible for Cargo to fetch the index without the required SSH keys being present on the machine when doing cargo build.
But it is true that the frontend and the API makes searching crates public.
To answer @techninja1008's question, Cargo doesn't send any credentials when doing cargo search and cargo download, which kinda forced these endpoints to be public as well in Alexandrie.

Within the implementation of cargo search from rust-lang/cargo:
https://github.com/rust-lang/cargo/blob/ccf781ab902d53ab80d76aa0e34f91df0d49e4b3/crates/crates-io/lib.rs#L338-L348

I think we can indeed at least do:

  • disabling registrations
  • require being logged in for all frontend endpoints and most of the API (except for Cargo-related search and download endpoints)

The rest of Cargo-related endpoints (like those related to owners and publication) are already authenticated.

That said, I don't know if the Cargo team is planning anything regarding this.

from alexandrie.

Hirevo avatar Hirevo commented on May 18, 2024

Also, we can maybe do it as an option within the config, rather than it being a cargo feature-flag, because it doesn't make us save on dependencies when not used, and having to recompile just to change an option could be annoying.

from alexandrie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.