Repository navigation
Conversation
First stacked PR for scoped PAT extracted from the prototype #47783 to ease reviewing. Next stacked PR is #47979 This PR: - merge the two existing token lists (classic and scoped) into one - add an admonition about the scoped PAT migration (missing the docs URL) ## Notes It's not possible to create classic tokens anymore with the `scopedPAT` flag enabled. ## How to test ### With the `scopedPAT` enabled (default on staging) Go to https://studio-staging-git-scopedpat-merge-token-lists-supabase.vercel.app/dashboard/account/tokens. - You shouldn't see two tabs anymore - If you had classic tokens, they should have the _classic_ badge - You can create scoped tokens - You have a way to copy newly created tokens above the list upon form submission ### With the `scopedPAT` disabled (use the devtool to override) - You shouldn't see two tabs anymore - If you had classic tokens, they should **not** have the _classic_ badge - You can create classic tokens - You have a way to copy newly created tokens above the list upon form submission ## Screenshots Before: <img width="775" height="515" alt="image" src="https://github.com/user-attachments/assets/35733e7f-6e3e-40f9-ac5b-cfd7caf5d830" /> After: <img width="767" height="671" alt="image" src="https://github.com/user-attachments/assets/2fd86e6e-6dc6-46c8-9c89-cbfc553e4eb9" />
Second stacked PR for scoped PAT extracted from the prototype #47783 to ease reviewing. Previous stacked PR is #47886 Next stacked PR is #48003 This PR: - refactor the scoped token creation form in a multi-step fashion ## How to test Go to https://studio-staging-git-scopedpat-scoped-token-creat-80c55b-supabase.vercel.app/dashboard/account/tokens - Click the _Generate new token_ button - Try submitting immediately. It should display errors correctly - Configure everything except permissions and try submitting. It should display a warning about missing permissions - Configure the permissions and submit. It should display the review step - Try going back, modify anything and submit - Create the token. It should display the token value with a button to copy it and a checkbox to confirm the copy. You cannot close the sheet at this step until you check the box and click _Done_.
Third stacked PR for scoped PAT extracted from the prototype #47783 to ease reviewing. Previous stacked PR is #47979 Next stacked PR is #47999 This PR add a way to view the tokens permissions <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a “View permissions” option for scoped access tokens. * Scoped token permissions now open in a dedicated viewing panel. * Scoped token support is enabled by default. * **Bug Fixes** * Improved token deletion confirmation to clearly identify the selected token. * Deletion dialogs now close correctly after successful removal. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fourth stacked PR for scoped PAT extracted from the prototype #47783 to ease reviewing. Previous stacked PR is #48003 Next stacked PR is #48002 This PR: - fix some accessibility issues - add unit tests <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added coverage for creating scoped access tokens at the project, organization, and account levels. * Verified validation for required fields, successful token creation, clipboard copying, and completion flow. * **Chores** * Added temporary browser console logging when viewing a scoped access token. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…n API specs (#48182) Fifth stacked PR for scoped PAT extracted from the prototype #47783 to ease reviewing. Previous stacked PR is #47999 Next stacked PR is #48359 This PR refactor how we get the map of which scopes enable which endpoint or mcp tool. Previously it was an hardcoded file. We now compute it from the OpenAPI specs of our API. This ensure the map stays up to date when the API changes. However, we don't have an always up-to-date equivalent for mcp tools so we duplicated code from platform that map the OAuth scopes they check with the FGA permissions. ## Notes The react-hook-form usage is not great. A follow up PR will fix it ## How to test - On https://studio-staging-git-scopedpat-scope-permissions-api-supabase.vercel.app/dashboard/account/tokens - Create a new token with a few permissions (their risk marker should be displayed: (_High risk_, _Medium risk_ or _Low risk_) - You should see the available endpoints and mcp tools in the review step <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added dynamic permission mapping for scoped access tokens, covering Management API endpoints and MCP tools. * Added a permissions endpoint with hosted-platform support and caching. * Updated scoped token creation and review screens to show capabilities based on granted permissions. * Added permission-aware risk indicators and tool visibility. * **Bug Fixes** * Improved authorization checks so endpoints and tools require all necessary scopes. * **Tests** * Added coverage for endpoint, scope, and MCP tool mapping behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
We don't follow good practices using react-hook-form for the scoped PAT. This PR aims to fix that: - pass `control` and `setValue` instead of `form` - call `useWatch` instead of `form.watch` No functional nor visual changes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved the scoped access token creation flow so permission selections and configured counts update reliably. * Ensured the review step and final token creation use the validated settings entered in the form. * Reset dependent resource selections when changing access modes to prevent conflicting configurations. * Improved handling of account-level confirmation and token expiration settings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fixes UX/UI issues: - when organization scope is selected: org selector should take the full width - Use org name and project name as the selected values label instead of their ids - There's a wrapping issue in multi-selector when more than one value is selected - There's an hover effect on disabled selects (when account scope selected) - On the review step: use the project/org names instead of their ids
The scoped PAT form does not follow the design system guidelines. No functional changes <img width="755" height="713" alt="image" src="https://github.com/user-attachments/assets/8529c584-e75a-4f20-a40f-db1a3b5aaee0" /> <img width="754" height="693" alt="image" src="https://github.com/user-attachments/assets/66791128-9083-4a93-9b14-1315b1b76ddb" />
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
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 |
🎭 Playwright Test Results (tanstack)Details
Flaky testsFeatures › rls-policies.spec.ts › RLS Policies › Create RLS Policy › should create an UPDATE policy with custom condition Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
## 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? @w3b6x9 initial pass at the announcement banner here. Please have a read of the copy and feel free to improve where you see fit. I also corrected how the actions are passed to our `<Admonition />` component. There's also an inline comment to remind us to update the `Learn more` link when we go live. | Before | After | |--------|--------| | <img width="755" height="264" alt="Screenshot 2026-08-03 at 14 03 34" src="https://github.com/user-attachments/assets/05b9e577-4d56-4c42-961a-37ac1e753141" /> | <img width="769" height="300" alt="Screenshot 2026-08-03 at 14 03 46" src="https://github.com/user-attachments/assets/11b7bdef-f7a3-47e5-a8b5-a021aafb0bca" /> |
31e158d to
d190858
Compare
d190858 to
fde0554
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? This touches a few things, brushing them up in anticipation of release. **Fixes and updates:** - Fixed sheet width resizing on content changing within sheet. - Tidied up labelling styles on Permissions row. - Show expand icon on multi select input. - Permissions list got a small tidy up. - Vertical padding on footer to match rest of the sheet. - Risk badge updated. - Risk badge tooltip tidied up. - View permissions sheet tidied up and updated to include MCP and API endpoints. - Second step/token summary tidied up.
|
@w3b6x9 might want to pull latest from the parent branch, I styled some bits, though I don't think it'll effect your changes too much. |
fde0554 to
0897dad
Compare
The permission scope map previously flattened every `x-fga-permissions` annotation into a single conjunctive scope list, turning OR-alternatives (e.g. development vs production branching on `GET /v1/.../branches`) into impossible AND requirements. EndpointMap and McpMap now store ScopeGroupAlternatives (string[][]) verbatim, and an item is enabled when ALL scopes of at least ONE group are granted — matching how the mgmt-api FGA guard actually evaluates the annotation. Edge cases follow plain DNF semantics: `[[]]` (one empty group) is ungated and callable by any token, `[]` (no groups) is satisfied by nobody, and endpoints with unusable annotations are dropped rather than recorded as ungated. The MCP tool map is rewritten as a direct audit of the Management API endpoint each tool's handler in @supabase/mcp-server-supabase actually calls, with the endpoint named above every entry for re-auditing. The old two-hop derivation (tool -> legacy OAuth scope bundle -> FGA permissions) expanded coarse bundles into conjunctions of permissions the tool never uses, hiding tools from tokens that could genuinely call them. The map now covers the full tool registry, including ungated tools (search_docs, get_project_url, get_cost, confirm_cost), and a new test diffs its keys against the installed package's tool schemas so a dependency bump that adds or drops a tool fails CI by name. buildAPIPermissionScopeMap now fetches the v1/v2 specs in parallel and indexes them in one pass (their path prefixes can't collide), replacing the lodash mergeWith custom-merger, and deep-clones the module-level tool mapping so callers can't mutate state that outlives the request.
0897dad to
0eff5a0
Compare
Two small copy fixes to keep PAT descriptions accurate: - temporary-access: drop the "(PAT or Scoped PAT)" parenthetical — the token used as the Postgres role password is simply the user's Personal Access Token, and calling out scoped variants here was confusing - api/introduction: describe PATs as tokens with a custom expiry rather than "long-lived", since expiry is now user-configurable
There was a problem hiding this comment.
Just curious if we considered the effect of rewording this on the data cleanness?
## 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? First step in breaking down #48635 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Removed the scoped access-token form, including token details, expiration settings, resource access, and permission configuration. * Removed resource and permission selection controls from the access-token workflow. * **Tests** * Removed automated coverage for access-token validation, permission handling, expiration logic, and resource selection. <!-- 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? First step in breaking down #48635 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Removed the scoped access-token form, including token details, expiration settings, resource access, and permission configuration. * Removed resource and permission selection controls from the access-token workflow. * **Tests** * Removed automated coverage for access-token validation, permission handling, expiration logic, and resource selection. <!-- 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]>
… smaller version (#48809) ## 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? Breaking down #48635 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Scoped access tokens now support alternative permission requirements, enabling more precise access for APIs and tools. - Added clearer role and resource access evaluation, including project-specific permissions and partial read access. - Access reviews now identify unavailable or excessive permissions and group inaccessible resources for easier resolution. - **Bug Fixes** - Improved handling of legacy, incomplete, or invalid permission data with safer fallback behavior. - Corrected access filtering for MCP tools and API capabilities. - **Documentation** - Updated access-review wording to clarify the relationship between scopes and related MCP tools. <!-- 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]>
The permission scope map previously flattened every
x-fga-permissionsannotation into a single conjunctive scope list, turning OR-alternatives (e.g. development vs production branching onGET /v1/.../branches) into impossible AND requirements. EndpointMap and McpMap now store ScopeGroupAlternatives (string[][]) verbatim, and an item is enabled when ALL scopes of at least ONE group are granted — matching how the mgmt-api FGA guard actually evaluates the annotation. Edge cases follow plain DNF semantics:[[]](one empty group) is ungated and callable by any token,[](no groups) is satisfied by nobody, and endpoints with unusable annotations are dropped rather than recorded as ungated.The MCP tool map is rewritten as a direct audit of the Management API endpoint each tool's handler in @supabase/mcp-server-supabase actually calls, with the endpoint named above every entry for re-auditing. The old two-hop derivation (tool -> legacy OAuth scope bundle -> FGA permissions) expanded coarse bundles into conjunctions of permissions the tool never uses, hiding tools from tokens that could genuinely call them. The map now covers the full tool registry, including ungated tools (search_docs, get_project_url, get_cost, confirm_cost), and a new test diffs its keys against the installed package's tool schemas so a dependency bump that adds or drops a tool fails CI by name.
buildAPIPermissionScopeMap now fetches the v1/v2 specs in parallel and indexes them in one pass (their path prefixes can't collide), replacing the lodash mergeWith custom-merger, and deep-clones the module-level tool mapping so callers can't mutate state that outlives the request.