Skip to content

Add distribution and action scoping to Cargo tokens - #63

Open
aKlimau wants to merge 1 commit into
pulp:mainfrom
aKlimau:add-token-skope
Open

aKlimau wants to merge 1 commit into
pulp:mainfrom
aKlimau:add-token-skope

Conversation

@aKlimau

@aKlimau aKlimau commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Two scope axes: distributions (M2M to RustDistribution) and actions (publish, yank; yank covers unyank).

The scope check runs in addition to the existing RBAC check on every publish and yank, so a token can never exceed its owner's permissions.

The scope check runs in addition to the existing RBAC check on every publish and yank, so a token can never exceed its owner's permissions.

Deleting the last scoped distribution revokes the token. The M2M cascades, so an emptied scope would otherwise read as "unrestricted" and silently widen the token. Partial loss leaves it valid for the distributions that remain.

Scopes are immutable. No update endpoint; revoke and re-create to change them.

closes pulp#48

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
actions:='["publish"]'
```

The available actions are `publish` and `yank`, where `yank` covers both yanking and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cargo has publish-new and publish-update rather than a single catchall scope. Can you explain why we're changing the scopings - is it because we don't currently track crate ownership? If we could keep it as close as possible to the upstream model (without trying to introduce crate ownership right now) that would be ideal.

Comment thread pulp_rust/app/models.py
silently widen to everything its owner can reach. Revoking it keeps the deletion from
granting the bearer reach the owner never delegated.
"""
token_pks = getattr(instance, "_scoped_cargo_token_pks", None)

@dralley dralley Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold up, do these objects only exist in memory? Would restarting pulp impact / prevent revocation from working properly?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants