pulp / pulp/pulp_rust

RFE: Support Crate Ownership

Open
#47 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Triage-Needed
Dominant language
Python
Stars
1
Forks
4
Avg merge
2d 8h
Merged PRs (30d)
6

Description

Consider supporting Crate ownership like crates.io -- users would be able to publish or modify only crates which they have maintainership over.

This is more of a long-term plan and should probably be optional. The "if you can auth, you can push" mode ought to continue being supported.


Crate Ownership

Goal: Track who owns which crate names, and only allow owners to publish new versions or yank. Deferred — any authenticated user with distribution-level permission can publish any crate name for now.

a. CrateOwnership model
class CrateOwnership(BaseModel):
    distribution = models.ForeignKey(RustDistribution, on_delete=models.CASCADE)
    crate_name = models.CharField(max_length=255)
    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)

    class Meta:
        unique_together = ("distribution", "crate_name", "user")
  • Scoped per-distribution (different registries can have different owners for the same crate name)
  • First publisher of a crate name automatically becomes owner
  • Owners can add/remove other owners
b. Ownership endpoints

Implement the Cargo owner API:

  • GET /api/v1/crates/{name}/owners — list owners
  • PUT /api/v1/crates/{name}/owners — add owner (body: {"users": ["username"]})
  • DELETE /api/v1/crates/{name}/owners — remove owner
c. Publish authorization check

In CargoPublishApiView.put():

  1. If the crate name has no owners yet → allow (auto-assign publisher as owner)
  2. If the crate name has owners → only allow if request.user is an owner
d. Yank authorization check

Only crate owners (or distribution admins) can yank/unyank.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed CrateOwnership model and CargoPublishApiView.put(), then review the three Cargo owner endpoints and the yank authorization path. Done means ownership is scoped per distribution, first publishers are assigned automatically, owners can manage owners, and publish/yank permissions follow the stated rules while unauthenticated ownership mode remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authorization, backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.