-
-
Couldn't load subscription status.
- Fork 4.5k
feat(scopes): Use project:distribution permission for check-for-updates endpoint #102295
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
base: master
Are you sure you want to change the base?
Conversation
Add a new ProjectDistributionPermission class that uses the project:distribution scope for read access. Update the preprodartifacts/check-for-updates endpoint to use this new permission, allowing integration tokens with the distribution permission to access the endpoint.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #102295 +/- ##
===========================================
+ Coverage 80.61% 80.96% +0.35%
===========================================
Files 8755 8755
Lines 389223 389374 +151
Branches 24730 24730
===========================================
+ Hits 313775 315272 +1497
+ Misses 75094 73748 -1346
Partials 354 354 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm but let's get the ui side in first before landing this. I will try and look today and send you a PR.
|
Thanks, I have one here: #102298 |
Include project:distribution alongside org:admin and project:admin scopes to ensure the token has both general project access and the specific distribution permission.
Switch from user auth tokens to organization integration tokens (OrgAuthToken) for the check-for-updates endpoint tests. Integration tokens are the appropriate authentication method for API-to-API communication and work correctly with the project:distribution permission scope. The previous approach using user auth tokens with multiple scopes (org:admin, project:admin, project:distribution) was causing 403 errors because the permission system expected proper organization-level integration tokens for this type of endpoint access.
This PR adds a new
project:distributionpermission scope to enable fine-grained access control for distribution-related endpoints.Changes
ProjectDistributionPermissionclass insrc/sentry/api/bases/project.pythat uses theproject:distributionscope for GET requestspreprodartifacts/check-for-updatesendpoint to useProjectDistributionPermissioninstead ofProjectReleasePermissionNote
This will break any existing distribution tokens and update checks!