> [!WARNING]
> Live readiness checks require
[CTRL-2277](https://linear.app/supabase/issue/CTRL-2277) in the target
environment; production deployment is pending.
## Problem
Trusted Partner consent must explain direct database access and project
blockers before authorisation.
[DEPR-732](https://linear.app/supabase/issue/DEPR-732)
## Solution
- Show Direct database access alongside the requested permissions.
- Check selected projects, or every project page for organisation-wide
grants.
- Separate blocking issues from SSL notices; block authorisation during
loading or errors and offer retry.
| After |
| --- |
| <img width="1280" height="1323" alt="Authorize API Access Supabase"
src="https://github.com/user-attachments/assets/adb6367a-bace-4b62-81b5-68ba4c11396c"
/> |
| Consent screen with Direct database access (previously “Table data”)
and Database management |
| <img width="1280" height="1323" alt="Authorize API Access Supabase"
src="https://github.com/user-attachments/assets/0c35900c-1059-49cd-b1c5-4e0cf5441b9b"
/> |
| Selected-project blockers and the separate SSL notice |
| <img width="1280" height="1323" alt="95741"
src="https://github.com/user-attachments/assets/1fbef4f0-0433-4c93-b390-84d210dfb665"
/> |
| Organisation-wide blockers _without_ project-removal actions |
## Review instructions
1. Open the [staging consent
screen](https://studio-staging-git-dnywh-depr-732-trusted-partn-f24cfb-supabase.vercel.app/dashboard/authorize?auth_id=11666aa8-7f7e-4705-b33a-981903fd682e).
Enable `enableScopedOAuthConsent` in the dev toolbar’s **Flags** tab if
needed.
2. Open Chrome DevTools → **Network** and reload. Select the **GET**
request ending in `/platform/oauth/authorizations/{id}`.
3. Right-click that request → **Override content**. Choose a local
folder and click **Allow**. Add `database_token_access:read` and
`database_token_access:write` to `scopes`. Use only the read scope to
check read-only access. Keep every other field, save with
**Cmd/Ctrl+S**, then reload with DevTools open.
4. Select projects. Override each **GET** request ending in
`/platform/organizations/{slug}/oauth/authorizations/{id}/projects/{ref}/database-access`.
Use `{"issues":[],"enables_ssl":false}` for ready projects, then
`{"issues":[],"enables_ssl":true}` for an SSL notice. Save and reload
after each change. Check Direct database access and Database management
are separate, and SSL alone allows authorisation.
5. Change a readiness response to
`{"issues":["postgres_upgrade_required","platform_unsupported"],"enables_ssl":true}`.
Save and reload. Check blockers prevent authorisation, SSL stays
separate, and removing a blocked project clears its blockers.
6. Set `project_scoping_mode: false` in the authorisation override. Save
and reload. Check any blocked project prevents organisation-wide
authorisation, with no project-removal actions.
7. Block a database-access request in Network and reload. Check
authorisation stays disabled. Unblock it and choose **Retry checks**.
8. For a returning app, override `existing_grant.approved_scopes` in the
request ending in `/preflight`. Save and reload. Check added, removed
and unchanged permissions.
9. Disable **Sources → Overrides → Enable Local Overrides**. Repeat
ready and blocked project checks with a real staging authorisation
before approving live readiness behaviour.
---------
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
## Problem
When an authorization fails because of permission issues, we currently
display _Unavailable_ next to the problematic projects in the project
selector list. This is confusing as those projects are available, just
not selectable for this authorization
## Solution
Display _permission issues_ instead
<img width="417" height="601" alt="image"
src="https://github.com/user-attachments/assets/331073ac-71e0-45b0-a607-dcbd47268d91"
/>
## Problem
Supabase admins can enable support for partial grants on some apps but
the consent screen doesn't support this scenario
## Solution
Detect partial grant support and warn users when they lack some
permissions, allowing them to confirm they want to authorize the app
anyway
<img width="846" height="2150" alt="image"
src="https://github.com/user-attachments/assets/37c48da9-395b-4425-b33d-7acdc8f3dcc1"
/>
## Description
Part of the work for OAuth apps with the scoped permissions. This PR
wires consent screen to the backend.
## Review instructions
### Setup
Copy the `examples/oauth-app-authorization-flow/.env.example` to
`examples/oauth-app-authorization-flow/.env`
> [!IMPORTANT]
> In next steps, make sure to copy the apps ids/secrets in the
`examples/oauth-app-authorization-flow/.env` with a way to differentiate
them:
> ```
> # org bound all projects
> SUPABASE_CLIENT_ID=xxx
> SUPABASE_CLIENT_SECRET=xxx
> ```
As an organization admin, go to the _Organization settings/OAuth Apps_
and create the following _Publishable apps_:
- `test_org_bound`:
- _Use the permissions of the person who connects_ unchecked
- _Ask for specific projects_ unchecked
- Select only _Database Read_ for the permissions
- `test_org_bound_projects`:
- _Use the permissions of the person who connects_ unchecked
- _Ask for specific projects_ checked
- Select only _Database Read_ for the permissions
- `test_member_bound`:
- _Use the permissions of the person who connects_ checked
- _Ask for specific projects_ unchecked
- Select only _Database Read/Write_ for the permissions
- `test_member_bound_projects`:
- _Use the permissions of the person who connects_ checked
- _Ask for specific projects_ checked
- Select only _Database Read/Write_ for the permissions
Make sure you have 3 projects in the org. Add a team member that have
Administration rights on the first project, read-only access to the 2nd
and no access to the third.
Install the `examples/oauth-app-authorization-flow` dependencies and
start the app.
- `test_org_bound`:
- connected on studio as the org admin
- click the `oauth-app-authorization-flow` button
- check that you don't have to select a project on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- connected as a simple team member, check that you have a message
indicating you can't approve this app
- `test_org_bound_projects`:
- connected on studio as the org admin
- click the `oauth-app-authorization-flow` button
- check that you have to select projects on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- connected as a simple team member, check that you have a message
indicating you can't approve this app
- `test_member_bound`:
- connected on studio as a member
- click the `oauth-app-authorization-flow` button
- check that you don't have to select a project on the consent screen
- check that the permissions requested are correct and you can approve
the app
- update the published app to add another permission
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
- `test_member_bound_projects`:
- connected on studio as the org admin
- click the `oauth-app-authorization-flow` button
- check that you have to select projects on the consent screen (you
should see only the two you have access to) and select them all one by
one
- check that the permissions requested are correct
- approve the app and check that you have an error related to the
project with read-only access
- unselect it and approve the app
- update the published app to include the _Database Write_ permissions
- return to the `oauth-app-authorization-flow` index and click its
button again
- check that the consent screen shows the permissions difference and
approve it again
## Description
Part of the work for OAuth apps with the scoped permissions. This PR:
- Update `<MultiSelector>` to allow consumers to react to search terms
changes
- Refactor OAuth app consent screen to ensure we can load projects
asynchronously with an infinite list and server side filtering
> [!NOTE]
> At this stage, the UI still only use mock data
## Review instructions
If all tests pass, we're good.
## Description
Part of the work for OAuth apps with the scoped permissions. This PR:
- refactors the authorize OAuth app consent screen to make it more
consistant with how we handle load requests
- remove the copy constants in favor of direct JSX like we do everywhere
- ensure the data hooks have optional parameters with runtime check to
be usable even when all needed data isn't loaded yet
> [!NOTE]
> At this stage, the UI still only use mock data
## Review instructions
If all tests pass, we're good.
## Context
We've been seeing many `NotFoundError: Failed to execute 'removeChild'
on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on
'Node'` events on Sentry which are historically known to be caused by
Google Translate in the browser.
There's technically no _right way_ to address this unfortunately, but
one of the solutions which should address most of these issues is to
wrap any dynamic text within a span - we've considered that quite a
while back tbh but never took the time to do this until today with the
help of Claude. Although just a heads up that it might not necessarily
completely eradicate those issues.
Also added an eslint rule which should prevent future occurences of this
<img width="1264" height="192" alt="image"
src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29"
/>
## 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?
The scoped OAuth consent interstitial: scope display, org/project
selection,
consent screen assembly, success screen, and post-submit role-validation
error state. Consolidates the former stacked PRs #49481, #49484, #49486,
#49489, #49951 into one reviewable unit (each contained the last; no
code
was dropped).
- Entirely behind `useFlag('oauthAppScopedGrants')` — no reachable UI
with
the flag off.
- Runs on the mock data layer from #49476 (`USE_MOCKS`-gated); no real
endpoints are called.
- Covers PROD-626, PROD-627, PROD-628, PROD-629, PROD-653.
Base is #49476 (data contracts + mocks); will retarget to master once it
merges.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>