Skip to content

Allow restricting API token to publish a subset of crates #849

@Nemo157

Description

@Nemo157

Now that #688 is available, it would be great to be able to generate a token that is only able to publish a single/limited subset of crates. (A subset to account for things like proc-macro crates commonly being published as a pair of relatively tightly coupled crates).

I'm not sure exactly where the UI for creating these tokens should go, one idea I have had so far:

  • In the "New Token" row on the "Account Settings" page add a little expander with text like "Limit Token Access", expanding that can show a list of all crates with checkboxes for selecting which to be able to publish to.

I feel that would not be great for a user that has access to many many crates though.

Alternative idea I had was to somehow do it via the crate page instead. I don't see any nice to allow adding additional crates to the token that doesn't basically end up with a massive list like above.


Probably worth doing a survey of if any other package repositories support something similar. Closest parallel I can think of is GitHub repository scoped API tokens, but as far as I'm aware they don't allow for accessing a selection of repositories; you either have a token that can access all repositories you have access to, or a token that can access a single repository. I'll try and take a look soon and update here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-accountsC-enhancement ✨Category: Adding new behavior or a change to the way an existing feature works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions