Commit Graph
10 Commits
Author SHA1 Message Date
Danny WhiteandJoshen Lim 4dbb966b2e feat(studio): show Trusted Partner access on OAuth consent (#53583)
> [!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>
2026-12-02 16:19:30 +07:00
Gildas Garcia fd5c02f1a0 fix(studio): Scoped OAuth apps - improve text for projects with permission issues (#54409)
## 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"
/>
2026-12-01 16:07:27 +01:00
Gildas Garcia ce6c5e71fa feat(studio): OAuth app consent screen support for partial grants (#54213)
## 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"
/>
2026-11-30 10:13:26 +01:00
Danny White a1b71bfdce fix(studio): clarify OAuth consent copy and hierarchy (#53702)
## Problem

The consent screen repeats information below the permissions and puts
the organization-level error away from the button it blocks.

## Solution

Place the member-bound role limit under **Permissions requested**, mark
section headings as headings, and group the role error with the action.
Keep the redirect destination centred in the footer.

| Before | After |
| --- | --- |
| <img width="890" height="1892" alt="CleanShot 2026-11-20 at 12 46
26@2x"
src="https://github.com/user-attachments/assets/1fa1b266-a82a-4fec-a840-50408f1e04fa"
/> | <img width="872" height="1706" alt="CleanShot 2026-11-20 at 12 46
32@2x"
src="https://github.com/user-attachments/assets/f0e510b1-e6b3-4e66-b3f7-61845c4cab71"
/> |
| <img width="874" height="1970" alt="CleanShot 2026-11-20 at 12 52
19@2x"
src="https://github.com/user-attachments/assets/97bcef92-50e7-453d-a1e4-9962b01a7cdf"
/> | <img width="862" height="1488" alt="CleanShot 2026-11-20 at 12 47
59@2x"
src="https://github.com/user-attachments/assets/556eb2f7-2d71-47ed-a21d-8a71a577bae6"
/> |

## Review instructions

1. **Before:** Open the [Scoped OAuth
tester](https://api.supabase.green/v1/oauth/authorize?response_type=code&client_id=a3999bfe-cfc7-4584-9c5a-ab6828d35aa3&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Foauth%2Fcallback)
and leave consent open.
2. **After:** Open the [deploy preview consent
screen](https://studio-staging-git-dnywh-oauth-consent-copy-supabase.vercel.app/dashboard/authorize?auth_id=606dbb8e-60ea-4155-bb36-70a7d31378dd).

**What to check**

1. Open consent for a member-bound staging test app. Compare the role
explanation under **Permissions requested** and the centred redirect
destination with the current staging screen.
2. Open an organization-wide request with a role that cannot grant it.
Alternatively, in Chrome DevTools → Network, use **Override content** on
the successful organization preflight GET response for an unscoped
request. Set `validation_failure` to
`{"scope_target":"all_projects","role":{"name":"read-only"},"failed_scopes":["database:write"]}`
and reload with DevTools open.
3. Check that the warning sits above the disabled **Authorize** button
and the requested permissions are hidden. Clear any overrides when done.
2026-11-24 10:14:44 +11:00
Danny White 828bd84820 fix(studio): make OAuth project scope explicit (#53701)
## Problem

An unchecked box leaves users to figure out that access is limited to
selected projects.

## Solution

Show two explicit project scope options as a set of radio buttons. A new
grant starts with selected projects. Reauthorising an all-projects grant
still preselects all projects.

## Review instructions

1. **Before:** Open the [Scoped OAuth
tester](https://api.supabase.green/v1/oauth/authorize?response_type=code&client_id=a3999bfe-cfc7-4584-9c5a-ab6828d35aa3&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Foauth%2Fcallback)
and leave consent open.
2. **After:** Open the [deploy preview consent
screen](https://studio-staging-git-dnywh-oauth-project-scope-supabase.vercel.app/dashboard/authorize?auth_id=606dbb8e-60ea-4155-bb36-70a7d31378dd).

| Before | After |
| --- | --- |
| <img width="880" height="1904" alt="CleanShot 2026-11-20 at 12 43
31@2x"
src="https://github.com/user-attachments/assets/87ed5f18-eebd-455e-a37a-9131fc9ac269"
/> | <img width="884" height="1948" alt="CleanShot 2026-11-20 at 12 43
45@2x"
src="https://github.com/user-attachments/assets/1ec03fb1-1208-496c-8ad0-1d5b6736c5da"
/> |

**What to check**

1. Open consent for a project-scoped staging test app in an organization
with projects.
2. Check that **All current and future projects** appears first and
**Selected projects only** is selected for a new grant.
4. Select a project, switch to all projects, then switch back. The
picker should reappear with your selection.
5. Repeat with an existing all-projects grant and check that the first
option is selected.
2026-11-24 10:14:13 +11:00
Gildas Garcia 10488ed799 feat(studio): Wire the OAuth apps consent screen to the backend (#53511)
## 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
2026-11-19 17:47:03 +01:00
Gildas Garcia b58913895c feat(studio): Refactor OAuth app consent screen for project selection (#53361)
## 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.
2026-11-18 13:16:31 +01:00
Gildas Garcia 45f4a115fa feat(studio): Refactor oauth app consent screen (#53357)
## 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.
2026-11-17 16:58:49 +01:00
Joshen Lim 6d08d66b7d Add eslint rule for google translate dynamic spans + address all issues (#52949)
## 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"
/>
2026-11-05 23:28:46 +08:00
454a232947 feat(studio): scoped oauth interstitial ui (#50090)
## 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>
2026-10-07 10:56:24 +02:00