Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
🎭 Playwright Test Results (tanstack)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
🎭 Playwright Test Results (tanstack)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
Scoped PATs are enforced server-side as the intersection of the token's granted scopes and the owner's live role, re-checked on every request. The UI previously said nothing about this: any member could select any permission scope for any resource, get no warning at creation, and the token view kept rendering stored scopes as fact after the owner's access changed. This adds advisory (never blocking) feedback across the whole scoped-token flow so users learn at selection time -- not at their first 403 -- what a token can actually do. Core (AccessToken.roles.ts, all pure and unit-tested): - FGA_SCOPE_MINIMUM_ROLE: all 83 permission scopes transcribed from the OpenFGA model's role unions, mapped to the lowest base role that holds them. A drift-guard test pins the key set to the scope ids published in @supabase/shared-types, so upstream additions fail CI here with re-transcription instructions. - estimateRoleLevel: derives the user's base role per org (or per project for project-invited members) from the ungated /platform/profile/ permissions rows via four discriminating ABAC probes, verified against the platform's default_permissions seeds. Works for every member type with no permission-gated endpoint. - computeTokenRoleContext + applySelectionToRoleContext: role resolution (expensive, memoized) is split from selection evaluation (cheap, re-run per permission toggle). Results carry per-resource failing roles, including per-project detail for members invited to projects rather than the org. Creation form: - Orgs where the user only has project-level access are disabled in org-scope mode, with an inline explanation. - Permission rows and the review summary show a red "Exceeds your role" pill whose tooltip names the exact resources where requests would be denied, the required role, and the user's actual role there (spelling out per-project roles for project-invited members). - The review admonition breaks exceeded permissions down per resource, organizations first; the risk badge is computed on the role-capped effective scope set. - The immutability warning moved from a persistent admonition to micro-copy at the point of commitment; the permissions step links the access-control docs. Token view sheet: - Lost access is distinguished from deletion (deleting a project/org erases the token's FGA bindings; removal does not): bindings that vanished render a "resources no longer exist" state, while bindings the user can no longer reach show an anonymous count with a "No longer accessible" badge and a "removed from" admonition. - Accessible resources list name plus ref/slug; capabilities carry the same exceeds-role pills; risk reflects what the owner's current role allows. Header now has separate Access control and API docs buttons (DocsButton gained a label prop). All signals recompute from live org/project/permission queries, so the view tracks membership changes without stored state, and everything degrades to "no warnings" while data loads or on self-hosted.
a7d1d53 to
56ef87a
Compare
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Logic-only extraction from #48742. Scoped PATs are enforced server-side as the intersection of the token's granted scopes and the owner's live role, re-checked on every request. This lands the pure inference layer that will power advisory (never blocking) UI feedback; no UI consumes it yet. - FGA_SCOPE_MINIMUM_ROLE: all 83 permission scopes transcribed from the OpenFGA model's role unions, mapped to the lowest base role that holds them. A drift-guard test pins the key set to the scope ids published in @supabase/shared-types, so upstream additions fail CI here with re-transcription instructions. - estimateRoleLevel: derives the user's base role per org (or per project for project-invited members) from the ungated /platform/profile/ permissions rows via four discriminating ABAC probes. Works for every member type with no permission-gated endpoint. - computeTokenRoleContext + applySelectionToRoleContext: role resolution (expensive, memoized) is split from selection evaluation (cheap, re-run per permission toggle). AccessToken.permissions.ts gains only what the roles module needs: the PermissionLevel type and the catalog's `level` field (decides whether an org or project role governs a resource), plus getEntryScopes, which selectionToScopes now reuses. The UI-only additions from #48742 (risk badge/dot variants, mode labels, the OverallRisk.text -> description rename) are deliberately left out so this PR touches no .tsx. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added role-aware evaluation for scoped access-token permissions. * Added support for organization- and project-level permission scoping. * Added guidance when selected permissions exceed the current role, including read-only downgrades and inaccessible resources. * Added clearer grouping of permission access issues by resource. * **Tests** * Added comprehensive coverage for role mapping, permission evaluation, scoping, and failure scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Wen Bo Xie <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Extracts the token view sheet slice of #48742 (w3b6x9/scoped-pat-access-feedback, commit 56ef87a). The role-evaluation logic (estimateRoleLevel, computeTokenRoleContext, applySelectionToRoleContext, groupFailingResources) already landed on master via #48805 and #48809 — this PR only wires the view sheet up to it: - Bindings whose project/org was deleted (FGA bindings erased) render a "resources no longer exist" state; bindings the user can no longer reach render an anonymous count with a "No longer accessible" badge and a "removed from" admonition. - Accessible resources list their name plus ref/slug; capabilities show "Exceeds your role" pills and the risk badge reflects what the owner's current role actually allows. - Header split into separate "Access control" and "API docs" buttons. - Everything recomputes from live org/project/permission queries (no stored state) and degrades to no warnings while loading or on self-hosted. Also gives DocsButton an optional `label` prop (defaults preserve existing behavior for every other consumer) so the two header buttons can carry distinct text. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enhanced access-token details with permission categories, risk summaries, endpoint, and MCP information. * Added warnings for permissions exceeding the token’s role. * Clearly identifies inaccessible, deleted, or unavailable organizations and projects. * Added resource details and remediation guidance for unusable tokens. * Documentation links can now display custom labels. * **Bug Fixes** * Improved access evaluation when organization or project data is incomplete or access has changed. * Deferred resource loading until token details are opened. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Sonnet 5 <[email protected]>
Scoped PATs are enforced server-side as the intersection of the token's granted scopes and the owner's live role, re-checked on every request. The UI previously said nothing about this: any member could select any permission scope for any resource, get no warning at creation, and the token view kept rendering stored scopes as fact after the owner's access changed. This adds advisory (never blocking) feedback across the whole scoped-token flow so users learn at selection time -- not at their first 403 -- what a token can actually do.
Core (AccessToken.roles.ts):
Creation form:
Token view sheet:
All signals recompute from live org/project/permission queries, so the view tracks membership changes without stored state, and everything degrades to "no warnings" while data loads or on self-hosted.