Skip to content

feat: OAuth scopes for orgs and teams#28040

Closed
supalarry wants to merge 18 commits intolauris/cal-7030-feat-oauth-client-scopesfrom
lauris/cal-7201-feat-oauth-scopes-for-orgs-and-teams
Closed

feat: OAuth scopes for orgs and teams#28040
supalarry wants to merge 18 commits intolauris/cal-7030-feat-oauth-client-scopesfrom
lauris/cal-7201-feat-oauth-scopes-for-orgs-and-teams

Conversation

@supalarry
Copy link
Contributor

@supalarry supalarry commented Feb 18, 2026

Fixes #27893

@supalarry supalarry requested review from a team as code owners February 18, 2026 15:30
@linear
Copy link

linear bot commented Feb 18, 2026

@github-actions github-actions bot added the High priority Created by Linear-GitHub Sync label Feb 18, 2026
@github-actions github-actions bot added the ❗️ migrations contains migration files label Feb 18, 2026
@supalarry supalarry changed the base branch from main to lauris/cal-7030-feat-oauth-client-scopes February 18, 2026 15:31
@graphite-app graphite-app bot added the core area: core, team members only label Feb 18, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 3 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/api/v2/src/modules/auth/guards/oauth-permissions/oauth-permissions.guard.e2e-spec.ts">

<violation number="1" location="apps/api/v2/src/modules/auth/guards/oauth-permissions/oauth-permissions.guard.e2e-spec.ts:235">
P3: This helper duplicates the existing getAccessToken logic; consider generalizing the existing helper to accept an optional userId or reuse it instead of reimplementing the OAuth token exchange flow.</violation>
</file>

<file name="apps/api/v2/src/modules/auth/guards/roles/roles.guard.ts">

<violation number="1" location="apps/api/v2/src/modules/auth/guards/roles/roles.guard.ts:30">
P1: Security: Bypassing RolesGuard for third-party tokens conflates OAuth *scope* authorization with *role/membership* authorization. OAuthPermissionsGuard only checks that the token has the right scopes — it does not verify the user's role within a specific org/team. This means a third-party token with e.g. `ORG_PROFILE_READ` scope could access endpoints requiring `ORG_ADMIN` role, because the role check is skipped entirely. Scopes and roles are orthogonal authorization layers and should both be enforced.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

@devin-ai-integration

This comment was marked as resolved.

@supalarry
Copy link
Contributor Author

Implemented feedback from Carina:

  1. When developer creates an OAuth client we now group possible scopes under "user", "team" and "organization". Notably, all of them by default are now deselected.

BEFORE:
Screenshot 2026-02-20 at 11 04 31

AFTER:
Screenshot 2026-02-20 at 11 34 46

  1. In the authorization screen we display all scopes if only, for example, user scopes are requested
Screenshot 2026-02-20 at 12 24 28

if they also include team and organization scopes then we group them
Screenshot 2026-02-20 at 12 24 22

  1. When admins review OAuth clients warn them if they contain team or org scopes
Screenshot 2026-02-20 at 12 31 18

…al-7201-feat-oauth-scopes-for-orgs-and-teams
@supalarry supalarry closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consumer core area: core, team members only High priority Created by Linear-GitHub Sync ❗️ migrations contains migration files size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: OAuth scopes for orgs and teams

1 participant