Skip to content

Conversation

@runningcode
Copy link
Contributor

@runningcode runningcode commented Oct 29, 2025

This PR adds a new project:distribution permission scope to enable fine-grained access control for distribution-related endpoints.

Changes

  • Add ProjectDistributionPermission class in src/sentry/api/bases/project.py that uses the project:distribution scope for GET requests
  • Update preprodartifacts/check-for-updates endpoint to use ProjectDistributionPermission instead of ProjectReleasePermission

Note

This will break any existing distribution tokens and update checks!

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.
@runningcode runningcode requested a review from a team as a code owner October 29, 2025 08:26
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 29, 2025
@runningcode runningcode changed the title feat(scopes): Add project:distribution permission scope feat(scopes): Use project:distribution permission for check-for-updates endpoint Oct 29, 2025
@runningcode runningcode requested a review from chromy October 29, 2025 08:28
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

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              

Copy link
Contributor

@chromy chromy left a 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.

@runningcode
Copy link
Contributor Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants