fix: re enable scopes (CM-1231)#4210
Draft
ulemons wants to merge 2 commits into
Draft
Conversation
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR re-enables Auth0 scope enforcement for the public v1 packages endpoints, now that the required scopes exist in the Auth0 staging tenant. It ensures packages-related endpoints consistently require both read:packages and read:stewardships, aligning access control with the data returned by these endpoints (which includes stewardship fields).
Changes:
- Restores
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'all')onPOST /v1/packages:batch-stewardship. - Re-enables scope enforcement for all
/v1/packages/*endpoints by applying a singlerouter.use(requireScopes(...))inpackagesRouter. - Removes the previously-commented-out per-route scope middleware blocks and TODOs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/src/api/public/v1/packages/index.ts | Adds a top-level router.use(requireScopes([...], 'all')) so all /packages endpoints require both scopes. |
| backend/src/api/public/v1/index.ts | Restores requireScopes([...], 'all') on POST /packages:batch-stewardship and re-adds SCOPES import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-enables Auth0 scope enforcement on all public packages endpoints after the scopes were added to the Auth0 staging tenant.
Changes
requireScopesmiddleware onPOST /packages:batch-stewardship— requires bothread:packagesandread:stewardshipsGET /packages,GET /packages/metrics,GET /packages/detail— requires bothread:packagesandread:stewardshipsrouter.use()at the top ofpackagesRouterfor clarityType of change
JIRA ticket
ticket