Skip to content

fix: re enable scopes (CM-1231)#4210

Merged
ulemons merged 5 commits into
mainfrom
fix/re-enable-scopes
Jun 19, 2026
Merged

fix: re enable scopes (CM-1231)#4210
ulemons merged 5 commits into
mainfrom
fix/re-enable-scopes

Conversation

@ulemons

@ulemons ulemons commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-enables Auth0 scope enforcement on all public packages endpoints after the scopes were added to the Auth0 staging tenant.

Changes

  • Restore requireScopes middleware on POST /packages:batch-stewardship — requires both read:packages and read:stewardships
  • Restore scope enforcement on GET /packages, GET /packages/metrics, GET /packages/detail — requires both read:packages and read:stewardships
  • Consolidate per-route scope checks into a single router.use() at the top of packagesRouter for clarity

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

JIRA ticket

ticket


Note

High Risk
Tightens authorization across many public endpoints and switches several checks from 'any' to 'all', so tokens missing either read scope or write stewardship scope will start failing where they previously succeeded.

Overview
Re-enables requireScopes on public v1 routes that were temporarily left open pending Auth0 staging scope configuration. Read paths now require both read:packages and read:stewardships ('all' mode); stewardship mutations require write:stewardships.

Coverage spans /akrites, legacy /ossprey, /packages (including a top-level router.use for all package GETs), /stewardships, and POST /packages:batch-stewardship. Adds WRITE_STEWARDSHIPS to SCOPES and removes the related TODO comments.

Reviewed by Cursor Bugbot for commit 06e1d4a. Bugbot is set up for automated code reviews on this repo. Configure here.

@ulemons ulemons self-assigned this Jun 15, 2026
Copilot AI review requested due to automatic review settings June 15, 2026 09:41
@ulemons ulemons added the Bug Created by Linear-GitHub Sync label Jun 15, 2026

Copilot AI left a comment

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.

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') on POST /v1/packages:batch-stewardship.
  • Re-enables scope enforcement for all /v1/packages/* endpoints by applying a single router.use(requireScopes(...)) in packagesRouter.
  • 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.

@ulemons
ulemons force-pushed the fix/re-enable-scopes branch from 0a97231 to b3c8d33 Compare June 19, 2026 09:34
@ulemons
ulemons marked this pull request as ready for review June 19, 2026 09:34
Copilot AI review requested due to automatic review settings June 19, 2026 09:34

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b3c8d33. Configure here.

Comment thread backend/src/api/public/v1/index.ts Outdated

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Comment thread backend/src/api/public/v1/index.ts Outdated
Comment thread backend/src/api/public/v1/packages/index.ts Outdated
Comment thread backend/src/api/public/v1/akrites/index.ts Outdated
Comment thread backend/src/api/public/v1/akrites/index.ts Outdated
Comment thread backend/src/api/public/v1/akrites/index.ts Outdated
Comment thread backend/src/api/public/v1/akrites/index.ts Outdated
Comment thread backend/src/api/public/v1/akrites/index.ts Outdated
ulemons added 5 commits June 19, 2026 11:45
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 19, 2026 10:12
@ulemons
ulemons force-pushed the fix/re-enable-scopes branch from 5258b1d to 06e1d4a Compare June 19, 2026 10:12

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

packagesRateLimiter,
// TODO: restore once read:stewardships is added to Auth0 staging tenant
// requireScopes([SCOPES.READ_STEWARDSHIPS]),
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'all'),
router.get('/metrics', safeWrap(metricsHandler))
router.get(
'/metrics',
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'all'),
router.get('/metrics', safeWrap(metricsHandler))
router.get(
'/metrics',
requireScopes([SCOPES.READ_PACKAGES, SCOPES.READ_STEWARDSHIPS], 'all'),
// requireScopes([SCOPES.WRITE_STEWARDSHIPS]),
safeWrap(openStewardship),
)
router.post('/', requireScopes([SCOPES.WRITE_STEWARDSHIPS]), safeWrap(openStewardship))
@ulemons
ulemons merged commit ee124fc into main Jun 19, 2026
17 checks passed
@ulemons
ulemons deleted the fix/re-enable-scopes branch June 19, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants