Skip to content

Implement token scope restrictions for our endpoints #5572

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

Merged
merged 3 commits into from
Dec 14, 2022

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Dec 1, 2022

This PR adjusts our AuthCheck calls for the three relevant endpoints (publish, change owner, yank) to check the token scope restrictions if the token has any.

Note that for the publish operation we unfortunately need an extra database query to determine if the request is trying to publish a new crate or a new version for an existing crate. This query is performed outside of the existing database transaction since we have somewhat relaxed consistency requirements here.

In the worst case, two new crates with the same name are published concurrently, which would require both requests to have a publish-new token scope.

Related:

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Dec 1, 2022
@Turbo87 Turbo87 requested a review from jtgeibel December 1, 2022 16:17
@Turbo87 Turbo87 mentioned this pull request Dec 1, 2022
7 tasks
@Turbo87 Turbo87 force-pushed the token-scope-endpoints branch from ea71d88 to 07a825c Compare December 3, 2022 11:57
@Turbo87 Turbo87 force-pushed the token-scope-endpoints branch from 07a825c to 50563ff Compare December 14, 2022 18:41
@Turbo87 Turbo87 force-pushed the token-scope-endpoints branch from 50563ff to 3399875 Compare December 14, 2022 18:45
@Turbo87 Turbo87 merged commit ead0cc8 into rust-lang:master Dec 14, 2022
@Turbo87 Turbo87 deleted the token-scope-endpoints branch December 14, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant