Commit Graph
269 Commits
Author SHA1 Message Date
Danny WhiteandJoshen Lim 0265ff935e feat(studio): configure direct database access in OAuth app settings (#54006)
> [!WARNING]
> Partner eligibility requires
[CTRL-2282](https://linear.app/supabase/issue/CTRL-2282) in the target
environment; production deployment is pending.

## Problem

Trusted Partners need to configure direct database access for OAuth
apps. [DEPR-733](https://linear.app/supabase/issue/DEPR-733)

## Solution

- Save and reload direct-access scopes independently of Database
management.
- Allow new grants only for eligible organisations and
organisation-bound apps.
- Allow existing direct access to be removed when eligibility changes.

| After |
| --- |
| <img width="1280" height="754" alt="OAuth Apps Organization Settings
Basket Supabase"
src="https://github.com/user-attachments/assets/e9b78fb6-65e4-4299-ad07-a2f9538a36d5"
/> |
| `"is_trusted_partner": false` or missing |
| <img width="1280" height="754" alt="OAuth Apps Organization Settings
Basket Supabase (1)"
src="https://github.com/user-attachments/assets/cf78db2c-952c-47e9-9239-82aab2c8398a"
/> |
| `"is_trusted_partner": true` |

## Review instructions

1. Open the [staging
preview](https://studio-staging-git-dnywh-depr-733-oauth-app-dat-c71d4a-supabase.vercel.app/dashboard),
select a test organisation and open **OAuth Apps**. It should already be
`true, but enable `enableScopedOAuthPublish` in the Studio dev toolbar’s
**Flags** tab if needed.
2. Open Chrome DevTools → **Network**, then click **Publish OAuth app**.
3. In Network, select the **GET** request whose URL ends in
`/platform/organizations/YOUR_ORG_SLUG`, without `/oauth/apps` after it.
Its response contains the organisation’s name and slug.
4. Right-click that request → **Override content**. Choose a local
folder and click **Allow**. Add `"is_trusted_partner": true` to the
top-level JSON object, keeping every other field. Save with
**Cmd/Ctrl+S**.
5. Reload with DevTools open, reopen **Publish OAuth app**, and choose
**An owner, once for the whole organization** under authorisation.
6. Under **Application permissions**, find **Direct database access**.
Try **No access**, **Read only** and **Read and write**. Change
**Database management** separately and check the two values stay
independent.
7. With direct access selected, check **Each member, for themselves** is
unavailable. Set direct access to **No access**, choose member
authorisation, and check the Direct database access dropdown becomes
disabled.
8. Switch back to organisation authorisation, select direct access and
open **Preview consent for users**. Check its label and access level
match the form.
9. Change the overridden field to `false`, save and reload. Reopen the
new-app form and check Direct database access is hidden.
10. Disable **Sources → Overrides → Enable Local Overrides**. In a
genuinely eligible staging organisation, create a disposable app with
direct access, save and reopen it. Change its access level, save and
reopen again, then remove direct access. Check Database management
remains unchanged.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-12-02 16:50:36 +11:00
K-Dog (Kevin) dc4f247e79 Revert "chore: update prod api types (#54394)" (#54404)
This reverts commit 37d4f444b4.

OpenFGA model needs updating first before updating the API types
2026-12-01 21:46:40 +08:00
K-Dog (Kevin) 37d4f444b4 chore: update prod api types (#54394)
Updated API types and addressed any type issues. Had to update
shared-types alongside.
2026-12-01 19:42:54 +08:00
Alaister YoungandAlaister Young 680633ee4f [FE-5108] (part 5) refactor(studio): migrate remaining interfaces off next/link (#54308)
Part 5 of a 6-PR stack migrating all `next/link` imports in
`apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known
external URLs) and removing `compat/next/link.tsx`.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and
`components/ui/**` |
| 2 | #54305 | `components/layouts/**` and top-level shell components |
| 3 | #54306 | Database, TableGridEditor, Storage, SQLEditor,
BranchManagement, Branching, Functions, Realtime |
| 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues,
Linter, Reports, QueryPerformance, QuerySources, ConfigDrift,
DiskManagement, Compute |
| **5** | **#54308 ← this PR** | **Remaining `components/interfaces/**`
(Org, Billing, Auth, Support, Home, SignIn, ConnectSheet, etc.)** |
| 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and
update basePath tests/docs |

Migrates the remaining `components/interfaces/**` directories off
`next/link`, leaving zero `next/link` component imports in
`apps/studio`.

**Changed:**

- Replaced `next/link` across all 73 remaining interface files
(`Organization`, `OrganizationInvite`, `Billing`, `Auth`, `Support`,
`ProjectHome`, `Home`, `Project`, `ProjectCreation`, `ProjectAPIDocs`,
`ApiAuthorization`, `App`, `ConnectSheet`, `SignIn`, `APIKeys`,
`Account`, `CliLogin`, `Docs`, `JwtSecrets`, `Platform`)
- Converted the sole remaining `UrlObject` link (`<Link href={{
pathname: '/sign-in-sso', query }}>`) in `SignInSSOForm.tsx` to `<Link
to="/sign-in-sso" search={query}>`
- Migrated `SupportLink.tsx` onto `DynamicLink`
(`createSupportFormUrl(...)`)
- Standardized external `target="_blank"` anchors with `rel="noreferrer
noopener"`, switched `OverviewMetrics.tsx` observability link to typed
`<Link to="/project/$ref/observability/auth">`, and adopted `InlineLink`
/ `InlineLinkClassName` on inline paragraph links per review feedback

Addresses
[FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link)

## To test

- [ ] Check Organization (billing, usage, team, documents, AWS
Marketplace), Auth (providers, templates, rate limits, users, OAuth
apps), Support form/links, Project Home, Connect sheet, and Sign-In/SSO
links
- [ ] Verify `SignInWithSSOButton` preserves query params when
navigating to `/sign-in-sso`
- [ ] Verify `SupportLink` pre-populates support form query parameters
cleanly

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 17:33:03 +08:00
Alaister YoungandAlaister Young 0f14ef4d67 [FE-5109] (part 5) refactor(studio): migrate remaining interfaces and router events off next/router (#54057)
Part 5 of a 6-PR stack migrating all `next/router` and
`next/compat/router` imports in `apps/studio` onto TanStack Router hooks
and removing the router shims.

| Part | PR | Scope |
| --- | --- | --- |
| 1 | #54053 | Core navigation helpers, `hooks/**`, `lib/**`,
`data/prefetchers/**` |
| 2 | #54054 | `components/ui/**` |
| 3 | #54055 | `components/layouts/**` and `state/tabs.tsx` |
| 4 | #54056 | Database, Branching, Compute, Edge Functions, Explorer,
SQL Editor, Storage, Table Editor |
| **5** | **#54057 ← this PR** | **Remaining `components/interfaces/**`
and `QueryInsightsTable` router events** |
| 6 | #54058 | Remove `next/router` & `next/compat/router` shims,
`_router-events.ts`, Vite aliases, and test mocks |

Migrates all remaining `apps/studio/components/interfaces/**`
directories off `next/router`, including the last production
`router.events` consumer (`QueryInsightsTable`) and the only default
`next/router` import (`DiscordCTACard`). After this PR, zero files under
`apps/studio/components/**` import `next/router` or
`next/compat/router`.

**Added:**

-
`apps/studio/components/interfaces/QueryInsights/QueryInsightsTable/QueryInsightsTable.test.tsx`:
verifies that pathname changes clear selected query state without
mutating destination or history search params, while same-pathname
search updates preserve selection

**Changed:**

- Replaced the sole production `router.events.on('routeChangeStart',
...)` consumer in `QueryInsightsTable.tsx` with a `pathname` effect that
clears `onCurrentSelectQuery` on pathname changes, and derived
`searchQuery` directly from `nuqs` (`urlSearch`) instead of mirroring it
in local state. Drops the legacy `setQueryStates({ search: null })` call
on leave, which ran after `history.push` on TanStack Router (targeting
the destination URL rather than the previous history entry, while
browser Back is expected to restore previous search params).
- Removed the `router: NextRouter` prop from `ReportWidgetRendererProps`
in `Reports/ReportWidget.tsx` and updated its callers (`ChartBlock`,
`ReportHeader`, `CreateReportModal`)
- Updated `LOG_ROUTES_WITH_REPLICA_SUPPORT` in
`Settings/Logs/Logs.constants.ts` from `[ref]` to `$ref` for TanStack
route patterns
- Replaced the default `import router from 'next/router'` in
`Support/DiscordCTACard.tsx` with `useNavigate`
- Replaced `useRouter` across `Account`, `Advisors`, `App`, `Auth`,
`ErrorHandling`, `Home`, `HomePageActions`, `Integrations`, `Linter`,
`LocalDropdown`, `Observability`, `Organization`, `OrganizationInvite`,
`Platform/Webhooks`, `Project`, `ProjectCreation`, `ProjectHome`,
`QueryPerformance`, `RedeemCredits`, `Settings`, `Sidebar`, `SignIn`,
`Support`, `UnifiedLogs`, and `UserDropdown`
- Updated affected tests (`Auth/Users/UserPanel`, `Home/ProjectList`,
`LocalDropdown`, `Organization/*`, `OrganizationInvite`,
`RedeemCredits`, `Settings/General/*`, `SignIn/SignInRecoveryCodeForm`,
`UnifiedLogs/*`)

**Simplified:**

- `LocalDropdown`, `UserDropdown` and `RedeemCredits` build the current
route from `location.href`, so the hash keeps its leading `#`
- `NewOrgForm` navigates to the `returnTo` path instead of an absolute
URL, which was being treated as external. It also uses a typed
`/new/$slug` navigate.
- Read search params from `useParams()` instead of `location.search`
casts (`CronJobPage`, `QueuePage`, `LogsPreviewer`,
`LinkSupportTicketPage`, `MarketplaceSidebar`, `PlanCards`,
`SignUpForm`)
- Dropped the dead `isReady`/`isRouterReady` constants and the
`navigate<AnyRouter, string>` casts where typed routes work
(`ForgotPasswordWizard`, `SignInPartner`, `ReportWidget`,
`ProjectUpgradeAlert`)
- Linter, `ReportHeader` and `LogsPreviewer` use `to: '.'` instead of a
separate pathname subscription. `CreateReportModal` builds the preserved
query params in `onSuccess` instead of a `useMemo`.
- Tests use the shared `createTestRouter` and `customRender` router.
`LocalDropdown` now tests that the hash is kept.

Addresses
[FE-5109](https://linear.app/supabase/issue/FE-5109/replace-the-nextrouter-shims-with-tanstack-router-hooks)

## To test

- [x] Query Insights: select a query and confirm search/filter updates
keep selection while switching projects/routes clears it; navigating to
Logs keeps Logs' query params intact and pressing Back restores Query
Insights' `?search=` param cleanly
- [x] Auth / Sign-in flows: sign in, sign up, MFA, recovery code,
forgot/reset password, and partner sign-in preserve `returnTo` and
redirect as expected
- [x] Organization & Project flows: creating an org/project, accepting
an org invite, claiming a project, redeeming credits, and
deleting/pausing/restarting a project or branch navigate cleanly
- [ ] Logs & Reports: replica selector appears on supported log routes
(`LOG_ROUTES_WITH_REPLICA_SUPPORT`), saved log queries open, and custom
reports create/navigate properly
- [ ] Sidebar, LocalDropdown, UserDropdown, Integrations
(Cron/Queues/Marketplace), Advisors/Linter, and Unified Logs navigate
cleanly

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-12-01 14:53:27 +08:00
Ali Waseem 0c5d4d1bc1 fix(studio): reset selected orgs when switching scoped token resource access (#54323)
Switching resource access on the scoped access token form now clears the
selected organizations as well as the selected projects, so a selection
made in one mode doesn't carry over to the other.

Adds a test covering the Project → Organization switch.
2026-11-30 13:00:37 -06:00
supabase-vercel-tedd[bot] d86bc8fb9d fix(studio): keep the new MFA factor when clicking outside the verify dialog (#54223)
## Problem

On the account Security page, when you set up an authenticator app, a
click outside the "Verify authenticator app" dialog counts as a cancel
and unenrolls the factor that was just created. The dialog stays open
while that request runs, so you can still type a code and click Confirm,
and verification then fails with an unexpected server error. A page
element that stays clickable above the dialog, such as a consent banner,
triggers this easily.

## Solution

`ConfirmationModal` gets an optional `dismissOnInteractOutside` prop
(default `true`, so no other dialog changes). The authenticator verify
step turns it off. Only Cancel, the close button, or Escape cancel setup
and remove the unverified factor. The verify step also stays in its
loading state while an unenroll is in flight, so Confirm can't run
against a factor that is being deleted.

## How to verify

1. Open Account → Security and click Set up MFA. Enter a name and click
Generate QR code.
2. Click anywhere outside the "Verify authenticator app" dialog. The
dialog stays open, and the QR code and secret do not change.
3. Enter a valid code from the authenticator app and click Confirm. The
method is added ("MFA method added").
4. Repeat steps 1–2, enter a wrong code, and click Confirm. The toast
reports an invalid TOTP code, not an unexpected failure.
5. Repeat step 1, then click Cancel. The dialog closes and no unverified
authenticator remains in the list.
6. Open any other confirmation dialog in Studio and click outside it. It
still closes as before.

## Checks

Ran `pnpm turbo run typecheck --filter=studio --filter=ui-patterns`,
`eslint` (default and type-checks configs) on the changed Studio files,
`oxfmt --check` on the changed files, and `vitest run
components/interfaces/Account/TOTPFactors/AddNewFactorModal.test.tsx`.
The new test checks that an outside pointer or focus event does not
unenroll the factor and that Confirm then verifies it. It fails without
the fix.

## Checklist

- [x] I have read the [Contributing
Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] I have checked that the change works in the preview deployment
- [x] I have added or updated tests where applicable

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5246](https://linear.app/supabase/issue/FE-5246/clicking-outside-the-mfa-setup-dialog-deletes-the-new-factor-so).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-30 13:39:16 +00:00
Danny White daef6f6e8d fix(studio): align scoped token permission controls (#54164)
## Problem

The scoped token editor uses different access labels from OAuth. Its
permission descriptions are smaller, and the accordion headers can cut
across the rounded corners.

## Solution

Use **No access**, **Read only**, and **Read and write** in the scoped
token editor. Each permission keeps its existing access levels. Make
descriptions easier to read, keep space around badges, and align
selectors in a column on wider screens. Use the same colour for borders
and dividers, and round the outside edges of the permission list and
capability cards.

Use sentence case for permission names in the picker and matching
documentation.

| Before | After |
| --- | --- |
| <img width="767" height="536" alt="CleanShot 2026-11-27 at 11 53 58"
src="https://github.com/user-attachments/assets/f2c36703-9383-49cb-89f0-86f3da0de10c"
/> | <img width="765" height="549" alt="CleanShot 2026-11-27 at 11 53
18"
src="https://github.com/user-attachments/assets/c5abe728-47c9-4594-9787-aff2bc54efec"
/> |

## Review instructions

1. With scoped tokens enabled, open **Account → Access Tokens** and
click **Generate new token**.
2. Choose a resource and expand a permission group. Check the available
access levels, the spacing around badges, and the selector alignment at
desktop and narrow widths.
3. Expand and collapse the first and last permission groups. Open a
scoped token’s details and check the capability card corners.
2026-11-30 16:18:31 +11:00
anthony lio f05fe34966 feat(ui): scroll area (#54023)
## Problem

- on `/kb/guides/migrate-from-auth0` in safari 27 on macos, the mouse
wheel does not scroll the page and a trackpad does
- radix scroll area bar in the table of contents adds a non-passive
`wheel` listener on `document`
- webkit stops mouse-wheel page scroll when that listener meets
`overscroll-behavior-y: none` on `html`, which kb sets

## Solution

- replaces radix with base ui in the `ui` scroll area parts because base
ui binds its wheel listener to the scrollbar element
- replaces the radix `display: table` workarounds in the studio token
sheets and the connect sheet with a reset of the base ui content
`min-width`
- changes the docs ask ai scroll area to use the `ui` scroll area
- adds an inset focus ring to the scroll area viewport because base ui
makes an overflowing viewport focusable
- adds a `getAnimations` stub to the jsdom test setups because the base
ui viewport calls it
- adds `@base-ui/react` to the pnpm catalog + points the design system
scroll area page at the base ui docs

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

1. open the preview
[/kb/guides/migrate-from-auth0](https://kb-git-antlio-ui-scroll-area-supabase.vercel.app/kb/guides/migrate-from-auth0)
in safari on macos with a mouse
2. turn the mouse wheel and make sure that the page scrolls and the
table of contents marks the active heading
3. open the preview
[/design-system/docs/components/scroll-area](https://design-system-git-antlio-ui-scroll-area-supabase.vercel.app/design-system/docs/components/scroll-area)
and make sure that each demo shows its bar on hover and scrolls with the
wheel
4. make sure that the horizontal demo scrolls sideways
5. press `tab` until a demo takes focus and make sure that it shows an
inset focus ring
6. open a project in the [studio
preview](https://studio-staging-git-antlio-ui-scroll-area-supabase.vercel.app/dashboard),
click `Connect` and make sure that a long code line scrolls inside its
code block and the sheet body does not scroll sideways
7. open the [docs
preview](https://docs-git-antlio-ui-scroll-area-supabase.vercel.app/docs),
press `cmd+k`, search for `auth` and make sure that the results list
scrolls

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-28 13:25:55 +02:00
Joshen Lim 434c00cb14 Joshenlim/fe 5196 move off scaffold components for remaining (#53911)
## Context

Final clean up of deprecated Scaffold components, just touches
- Account audit logs
- Project home page
- Database -> Column privileges
- Storage -> Analytics bucket details
- Storage -> Vector bucket details
- Settings -> Infrastructure -> Disk management
- Settings -> Infrastructure -> Read replica details
- Integrations -> Wrappers overview (Only for non supported integration
UI)
- Edge functions -> Empty state
- Auth -> Performance

Also replaces usage of `ScaffoldDivider` with just the `Separator`
component
And also adjusts the page container sizes of database pages from large
to default - these only have visual differences on viewport widths
larger than a laptop

Testing just needs a quick sweep of all these surfaces to make sure
nothing looks weird - will do so on my end too once the builds go
through!

For @supabase/security's review - review requirement was triggered as
`Documents.tsx` was updated in the organization settings page. But it
was just to change the Divider component 🙏
2026-11-26 21:28:17 +07:00
Alaister YoungandAlaister Young 87b9d0562e [FE-5111] refactor(studio): replace next/image shims with plain img (#54011)
Replaces all remaining `next/image` and `next/legacy/image` imports in
`apps/studio` with plain `<img>` elements and deletes both compat shims
and their Vite aliases (following #53906, which removed the last
`next/image` import from `packages/ui-patterns`).

**Changed:**

- Replaced 26 `next/image` and 3 `next/legacy/image` call sites across
`apps/studio` with plain `<img>` elements (every local `src` already
prepends `BASE_PATH` / `router.basePath`, and none used `loader`,
`priority`, `placeholder`, `quality`, or `onLoadingComplete`)
- Converted `fill` / `layout="fill"` usages in `IntegrationCard`,
`MarketplaceFeaturedHeroGrid`, `Integrations.constants`,
`useAvailableIntegrations`, and `IntegrationPanels` to Tailwind sizing
classes, and dropped no-op `layout="fixed"` props in `FormContents` and
`HookList`
- Replaced invalid `layout="fill" objectFit="cover"` props passed to
`next/image` in `HelpPanel` with `absolute inset-0 h-full w-full
object-cover`
- Cleaned up image accessibility across the touched call sites (accurate
alt text on feature preview screenshots and `HookList`, `alt=""` +
`aria-hidden="true"` on decorative icons/illustrations next to visible
labels)

**Removed:**

- `apps/studio/compat/next/image.tsx`
- `apps/studio/compat/next/legacy/image.tsx`
- `'next/image'` and `'next/legacy/image'` aliases from
`apps/studio/vite.config.ts`

## To test

- Confirm `git grep -E "next/(legacy/)?image" apps/studio/` has no
remaining imports
- Check images render as expected across the updated surfaces:
- **Integrations marketplace** (`/project/_/integrations`): featured
hero covers (`MarketplaceFeaturedHeroGrid`), integration icons in cards,
sidebar, and wrapper rows (`Integrations.constants`,
`useAvailableIntegrations`)
  - **Help panel**: Discord card background illustration
- **Account & settings**: Account Connections GitHub icon, Add-ons cards
(IPv4 / PITR / Custom Domain), Spend Cap card & side panel, user profile
avatars (`ProfileImage`), and Feature Previews modal images
- **Database Webhooks** (`FormContents`, `HookList`) and Third-Party
Auth provider dropdown/cards

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-26 16:23:41 +08:00
Gildas Garcia 4442d91d77 feat(studio): Wire org and users authorized apps list to backend (#53674)
## Description

Part of the work for OAuth apps with the scoped permissions. This PR
wires the org and users authorized apps lists to backend.
2026-11-19 21:40:12 +01:00
Joshen Lim 5d69a2d4ee Show OAuth provider connect in sign in methods (#53576)
## Context

Opt to show "Connect" providers CTA in Sign-in Methods by default to
allow users to link more identities to their account
This way if I did unlink my GH identity, i can link to another one as
well
<img width="745" height="393" alt="image"
src="https://github.com/user-attachments/assets/58f1b973-c175-4da5-931f-43735f493998"
/>
2026-11-18 11:06:59 +07:00
Sean Oliver b23e9e8d94 fix(consent): clear tracking state and reload when consent is withdrawn (#53294)
## Problem

Opting out from the Privacy Settings modal (www, docs, kb) clears no
cookies, and GTM keeps running. The banner's Opt out misses `_ga_<id>`,
`_dcid`, and PostHog.

## Solution

- `revokeTrackingConsent()` runs from `denyAll`, and from
`updateServices` unless every service is accepted. It clears `_ga`,
`_ga_*`, `_gcl_*`, `FP*`, `_dcid`, `session_id`, `ph_*_posthog`,
PostHog's localStorage, stale consent copies.
- PostHog resets and opts out, with persistence off. The opt-out
survives sign-out. A saved accept opts back in.
- Every opt-out calls `POST /platform/telemetry/reset` (keepalive,
errors ignored) to clear the API's HttpOnly `session_id`,
`anonymous_id`, and `user_id`. Studio's own call is removed.
- To stop GTM, a saved opt-out reloads the page if tracking was on,
waiting at most 1s for the reset.

## Review instructions

1. `cd packages/common && npx vitest run consent-state.test.ts
posthog-client.test.ts`
2. On prod: accept, open Privacy Settings, turn Marketing off, Confirm.
The page reloads with cookies gone and no `collect` request.

Tested: `common` (237 pass), `AnalyticsSettings` tests, CI unit tests
and typecheck. No browser test (previews lack Usercentrics).

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill
2026-11-17 16:38:23 -08:00
Danny White d7ead91b9f fix(studio): separate account email and password management (#53433)
## Problem

Account Security groups an email address and its password into one
identity row. The disabled unlink control suggests password removal is
temporarily unavailable, even though passwords can be changed but not
removed.

## Solution

Separate email address management from password management:

```text
Sign-in methods
  Email address    [edit]
  Password         Configured [edit]
  GitHub / ChatGPT [unlink]
```

- Accounts without a password get a Password row with an “Add” action
that opens the existing setup form
- Single-provider accounts retain the recovery warning, with the row now
owning the only “Add” action
- Existing MFA and recovery-code action priority is preserved
- Use distinct icons for password, SSO and generic providers, and
consistent edit/unlink controls (which resolves DEPR-715)

| After: GitHub Only | After: Password |
| --- | --- |
| <img width="1510" height="1554" alt="CleanShot 2026-11-16 at 13 29
21@2x"
src="https://github.com/user-attachments/assets/f71b86a1-81aa-4b4f-a64f-174c3550db73"
/> | <img width="1498" height="1358" alt="CleanShot 2026-11-16 at 13 29
57@2x"
src="https://github.com/user-attachments/assets/e36f2ed4-b580-4126-87b7-a655f4333427"
/> |


| After: Icon Refinment |
| --- |
| <img width="1570" height="846" alt="64227"
src="https://github.com/user-attachments/assets/556ff03c-a806-4c27-9ba8-b74992f4fe0d"
/> |
| <img width="1454" height="392" alt="CleanShot 2026-11-16 at 13 42
02@2x"
src="https://github.com/user-attachments/assets/c4215446-13aa-40d2-9e26-c7ae0f071395"
/> |

## Review instructions

Open [Account → Security
locally](http://localhost:8082/account/security) with Studio running
(`pnpm dev:studio`). Vercel marked the Studio deployment as ignored for
this PR, so no deploy preview is available.

1. **Account with a password:** check that Email address and Password
are separate rows. Password shows “Configured”. Hover or focus the
pencil buttons to see “Update email address” and “Change password”. The
password pencil opens the existing change-password page. Neither row
offers unlink.
2. **OAuth-only account, with `enableAccountPassword` enabled:** check
the Password row has an **Add** button. With one OAuth provider, the
warning appears above the rows but has no duplicate button. Click Add:
the existing password form shows the account email. Cancel and reopen
it. If using a disposable account, save a valid password and check that
the row changes to “Configured”.
3. **Linked external identity:** check that Unlink uses the same button
shape as the edit controls and still opens the confirmation. Cancel it.
4. **SSO account, if available:** check the briefcase icon and “Managed
by your organization”. Password setup must not be offered.
5. Repeat the row and action checks at phone width. Labels, addresses
and actions should remain visible.
2026-11-18 09:58:49 +11:00
Danny White d374842f03 fix(studio): hide email identity unlink until Auth clears password (#53352)
## Problem

Unlinking the email (password) identity from Account → Security removes
the email identity in the UI, but Auth leaves `encrypted_password` in
place. Users can still sign in with the old password, and **Add
password** fails with “Current password required when setting new
password.”

This is an Auth lifecycle bug. Until Auth clears the hash on email
unlink, Studio should not allow that unlink.

## Solution

Keep `enableAccountPassword` on so OAuth-only users can still add a
backup password (matches the changelog). Disable **Unlink** on the email
identity with tooltip “Temporarily unavailable”, and guard the confirm
handler. OAuth unlink is unchanged. Re-enable email unlink once Auth
clears the password hash.

No changelog change for now.

## Review instructions

1. Open the Studio preview → **Account → Security** → **Sign-in
methods**.
2. On an account with both GitHub and Email linked: hover the Email
unlink control and see **Temporarily unavailable**; GitHub unlink still
works; **Change password** still works.
3. On an OAuth-only account: **Add password** still appears when the
flag is on.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-13 15:31:24 +11:00
kemal.earth 1a2e8c679b feat(studio): handle visible project permissions for scoped pat (#53227)
## Problem

We had some org permissions lingering when the permission form was
scoped to project only.

## Solution

We narrow the possible permissions you can pass, here's what changed
with some guards.

- On Project scope, 11 permissions that can’t work no longer appear.
These are the org-level ones (Members, Projects, Billing and the like)
plus a few rows with nothing behind them. Organization scope and
full-access tokens look exactly as before.
- Organization Settings lost its “Read” option on Project scope. You can
pick None or Read-write. Read-write is still needed for one thing:
claiming a project through OAuth.
- Hidden permissions can’t slip through. Switching scope clears them,
presets skip them, the counters ignore them, and the request sent to the
API drops them as a last check.
- A shared package was updated, which wasn’t in the plan. Six of those
rows weren’t showing in the form at all because shared-data was on an
older version of @supabase/shared-types than Studio. Claude Code updated
it so the form matches the full permission list. **That makes the PR
touch package.json and the lockfile, so call it out in review.**
- One loose end: the Full access preset description still mentions
“organization members”, which is now hidden on Project scope. Fixing it
would mean changing copy, so it was left for a follow-up.

## Review instructions

1. Check out the branch and run `pnpm install` — `packages/shared-data`
picks up a new `@supabase/shared-types`, so this isn't optional.
2. Run `pnpm dev:studio` and open http://localhost:8082/account/tokens.
3. Open the dev toolbar (the floating Supabase button, or the user
dropdown), go to **FLAGS → ConfigCat**, and turn on `scopedPAT`.
4. Click **Generate new token**. **Resource access** defaults to
**Project**.
5. Expand all five permission categories. See that 11 rows are gone:
Organizations, Organization Audit Logs, Organization Billing And
Invoices, Organization Configuration, Organization Members, Organization
Projects, Platform Webhooks (organization), Project Authentication
Hooks, Project Authentication Users, Perform Developer Level Operations,
and the project-level SQL Snippets.
6. See that SQL Snippets (account-wide), Projects (account-wide),
Organization Settings, and every other row are still there.
7. Open the **Organization Settings** dropdown. See that it offers only
**None** and **Read-write**.
8. Switch **Resource access** to **Organization**. See that all 11 rows
come back, and Organization Settings offers **Read** again.
9. Set **Organization Members** to Read-write and **Organization
Settings** to Read. Switch to Project, then back to Organization. See
that both are now **None**.
10. Switch back to Project and apply **Preset · Read-only**. See that
Organization Settings stays at None and no hidden row is set.
11. Fill in a name, organization, and project, then create the token.
See that the `POST /platform/profile/scoped-access-tokens` request body
contains none of the hidden scope IDs.
2026-11-11 09:33:57 +00:00
Danny WhiteandJoshen Lim 6eb785a8a2 feat(studio): offer a backup authenticator after saving recovery codes (#52353)
## Problem

Initial MFA setup ends without offering a second authenticator as a
backup.

## Solution

After initial MFA setup and saving codes, offer another authenticator
without interrupting existing completion callbacks.

| After |
| --- |
| <img width="1024" height="759" alt="56157"
src="https://github.com/user-attachments/assets/81809970-2a50-425f-b4bb-792790ed8047"
/> |
| _The dialog that appears on step 2 below if first MFA method._ |

## Review instructions

1. Open
[Security](https://studio-staging-git-dnywh-recovery-backup-offer-supabase.vercel.app/dashboard/account/security)
with a disposable account without MFA. Set up MFA and save the recovery
codes.
2. Choose “Add another method” to start backup setup, or “Not now” to
finish. Adding a backup must not generate recovery codes again.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-10 23:09:18 +00:00
Danny White 16ea380714 fix(studio): reuse the account deletion confirmation pattern (#52350)
## Problem

The account deletion dialog repeats the organisation requirement and
leaves the form area blank while the membership check loads or fails.
Its confirmation form also differs from the other deletion dialogs in
Studio.

## Solution

```text
Request deletion
├─ Checking memberships → loading state
├─ Membership check fails → retry
├─ Organisation memberships found → leave all organisations first
└─ No memberships → shared email confirmation
```

Use `TextConfirmModal` for email validation and the shared copy control.

| Before | After |
| --- | --- |
| <img width="1098" height="576" alt="Image"
src="https://github.com/user-attachments/assets/01371989-b913-4b31-ac28-5da29447cf77"
/> | <img width="838" height="436" alt="Image"
src="https://github.com/user-attachments/assets/b3a2dc4d-eba0-4d2e-a698-f3c9fa14312f"
/> |
| <img width="876" height="674" alt="Image"
src="https://github.com/user-attachments/assets/002c5e0e-b081-40ff-aeba-1bb7a24d18d1"
/> | <img width="854" height="630" alt="Image"
src="https://github.com/user-attachments/assets/806a9e17-753f-4d8d-8100-ce037b84a8ff"
/> |


## Review instructions

1. In Preferences, select **Request deletion**. With organisation
memberships, confirm the dialog says **Leave all organizations first**.
Without memberships, check that the dialog shows your email and the
placeholder **Type your email address in here**. When the copy control
is enabled, select the email and check that it copies the address.
Submit a different email to check the inline validation. [Open
Preferences](https://studio-staging-git-dnywh-fix-account-deletion-copy-supabase.vercel.app/dashboard/account/me)
2. With the copy control enabled, verify that copying the email leaves
the form open and keeps the input unchanged.
2026-11-10 22:53:03 +00:00
Danny White 36e8bda235 fix(studio): align deletion panels (#53190)
## Problem

Account, project and organisation deletion settings use different
warning layouts and action placement. In the organisation panel, the
button sits inside the admonition description, so it stays below the
copy at wide widths.

## Solution

```text
Delete account / project / organisation
└─ Danger admonition
   ├─ Consequence and supporting copy
   └─ Action below the copy at narrow widths, beside it at wide widths
```

Standardise the affected settings section descriptions and preserve the
Vercel Marketplace action for partner-managed organisations. The account
confirmation flow is reviewed separately in #52350. Both PRs target
`master`.

| Before | After |
| --- | --- |
| <img width="1458" height="484" alt="CleanShot 2026-11-10 at 14 15
06@2x"
src="https://github.com/user-attachments/assets/2e7e627d-5079-464c-b7ef-51b93ca62e9a"
/> | <img width="1450" height="410" alt="CleanShot 2026-11-10 at 14 13
15@2x"
src="https://github.com/user-attachments/assets/88cdcd4a-463c-47be-9c95-3eab172bed29"
/> |
| <img width="1462" height="430" alt="CleanShot 2026-11-10 at 14 14
51@2x"
src="https://github.com/user-attachments/assets/84109e7e-2e42-4252-9f1b-9760ded1f2e7"
/> | <img width="1452" height="392" alt="CleanShot 2026-11-10 at 14 13
37@2x"
src="https://github.com/user-attachments/assets/d2238d64-5a32-456f-addc-6fd3ce1de1fe"
/> |
| <img width="1868" height="394" alt="CleanShot 2026-11-10 at 14 15
22@2x"
src="https://github.com/user-attachments/assets/a2ab7a9d-2d79-46fc-b600-ace07e098e55"
/> | <img width="1872" height="412" alt="CleanShot 2026-11-10 at 13 26
40@2x"
src="https://github.com/user-attachments/assets/fad70041-d0ea-4da6-b429-2b2fc39d2103"
/> |

## Review instructions

1. Open the deletion sections in **Account preferences**, a project's
**Settings → General** and an organisation's **General settings**.
2. At narrow and wide widths, check that the buttons sit below and
beside the copy respectively.
3. For a Vercel-managed organisation, check that the panel still directs
users to Vercel Marketplace.
4. In project and branch general settings, check the updated punctuation
in the affected section descriptions.
2026-11-11 09:41:12 +11:00
Danny White 767cc52c13 feat(studio): track recovery code copy and download (#53195)
## Problem

Studio tracks completion of recovery setup, but there are no events for
copying or downloading the codes.

## Solution

Track both actions in the shared recovery-code dialog. Record a copy
after the clipboard write succeeds and a download when the browser
starts it. The events carry no recovery-code values.

## Review instructions

1. Open [Recovery
codes](https://supabase.com/dashboard/account/security#recovery-codes)
on this branch's Studio preview with a disposable MFA account. Select
**Generate recovery codes** or **Regenerate** if it already has a set.
2. In **Save your recovery codes**, select **Copy**, then **Download**.
Check the browser network panel for `recovery_codes_copied` and
`recovery_codes_download_clicked` in the telemetry requests
(`telemetry/event`).
2026-11-11 09:40:32 +11:00
Danny White 797a43c7d0 feat(studio): add a shared shield badge to identity verification (#53145)
## Problem

The authenticator and recovery-code verification screens use the plain
Supabase logo, while other security interstitials use a badge to show
the purpose of the screen.

## Solution

Add the same shield with a cut-out check to **Verify your identity** and
**Use a recovery code**, using `InterstitialLogoBadge`.

| After |
| --- |
| <img width="942" height="456" alt="CleanShot 2026-11-09 at 18 02
09@2x"
src="https://github.com/user-attachments/assets/6e19eb79-7b42-4f95-967d-479ca38cc347"
/> |
| _Note the grey “Shield with cut-out check” for verification
interstitials like this one._ |
| <img width="1016" height="454" alt="CleanShot 2026-11-09 at 10 35
46@2x"
src="https://github.com/user-attachments/assets/dca51146-c7ee-44fd-a318-ef7101f1c77f"
/> |
| _No visual changes here, just showing the family of badges._ |

## Review instructions

1. On [Security on this
preview](https://studio-staging-git-dnywh-verification-shield-badge-supabase.vercel.app/dashboard/account/security),
follow [#52352’s breakpoint
steps](https://github.com/supabase/supabase/pull/52352#review-instructions)
with a disposable MFA account that has recovery codes. Check for the
shield in the top-right corner of the Supabase logo.
2. Choose **Use recovery code instead**. Check that the same badge
appears on the recovery-code screen.
2026-11-10 16:15:26 +11:00
Danny White c6a9401801 fix(studio): standardise interstitial logo badges (#52748)
## Problem

Interstitial logo badges use custom sizes and scaling. This becomes
brittle as we extend the amount of icons beyond just those in
Admonition.

## Solution

Share a standard 20 px badge with a 14 px icon with the new
`InterstitialLogoBadge`. Apply it to the _Secure your account_
interstitial.

This `InterstitialLogoBadge` will be used with a `shield-check` like
icon for the one-time password interstitial.

| After |
| --- |
| <img width="1016" height="454" alt="CleanShot 2026-11-09 at 10 35
46@2x"
src="https://github.com/user-attachments/assets/dca51146-c7ee-44fd-a318-ef7101f1c77f"
/> |
| _See the orange badge; this is now served via `InterstitialLogoBadge`.
No visual changes._ |

## Review instructions

1. With a spare or disposable staging account: open [Account Security on
this
preview](https://studio-staging-git-dnywh-interstitial-logo-badge-supabase.vercel.app/dashboard/account/security).
Set the following conditions:
   - Has one MFA method
   - Has no recovery codes (you might need to delete these)
3. Navigate to any other Studio page (you can just tap _Back to
dashboard_). Assuming you haven’t snoozed a reminder recently (see local
storage), you should land on _Secure your account_ interstitial.
4. Check the warning badge overlaps the Supabase logo cleanly in light
and dark mode.
2026-11-10 16:15:26 +11:00
Danny WhiteandJoshen Lim a93a3a78f5 feat(studio): clarify configured sign-in methods (#52356)
## Problem

In Account Preferences, the option to add a password looks like an email
sign-in method that is already set up.

## Solution

- Make configured sign-in methods easier to scan, with consistent rows,
icons and edit controls.
- Put **Add password** above the list as a separate suggestion. If
GitHub is your only way to sign in, explain how a password gives you a
backup. The Email row appears after you set a password.

This PR updates the existing section in Preferences and can merge on its
own. #52358 moves the section to Security and decides which action to
emphasise across sign-in, MFA and recovery codes.

| After |
| --- |
| <img width="744" height="294" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/f11d102f-58a3-4d8b-88fd-d03b51b40c0f"
/> |
| _User with GitHub only._
| <img width="1442" height="484" alt="CleanShot 2026-11-09 at 13 09
00@2x"
src="https://github.com/user-attachments/assets/885537d3-6b01-47dc-95f9-d545b7f8f249"
/> |
| _When a user has both GitHub and email sign-in, and a password
attached to that email address._ |
| <img width="1432" height="390" alt="CleanShot 2026-11-09 at 13 08
43@2x"
src="https://github.com/user-attachments/assets/f2d6f635-43f9-47ea-92cd-09d6c216f7bd"
/> |
| _SSO user._ |

## Review instructions

1. Open [Sign-in
methods](https://studio-staging-git-dnywh-recovery-signin-polish-supabase.vercel.app/dashboard/account/me#sign-in-methods)
with an OAuth-only test account. Check the password suggestion sits
above the configured methods.
2. On a disposable account, add a password. Check the Email row appears
and the email-edit tooltip opens above its button. Linking a provider
should still return you to Preferences.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-10 16:07:01 +11:00
Danny White 5cf3cf1032 feat(studio): make security the home for sign-in and recovery setup (#52358)
## Problem

- Sign-in methods are in Preferences, separate from MFA and recovery
settings.
- The risk of a single sign-in method (e.g. GitHub, and getting locked
out of that account) isn’t clearly communicated.

## Solution

- Bring sign-in methods, MFA and recovery codes together on the Security
page. If Security is disabled, sign-in methods remain accessible in
Preferences.
- Highlight the most important next step with a primary button. For
example, when MFA is off, “Set up MFA” takes priority over adding a
password.
- Explain the risk of relying on a single sign-in provider, and make it
clear which email address a new password will apply to.
- After connecting a sign-in provider, return users to the settings page
they can access. Links to password setup open the password dialog
directly.

| After |
| --- |
| <img width="1460" height="1426" alt="CleanShot 2026-11-06 at 14 54
23@2x"
src="https://github.com/user-attachments/assets/afb82601-1b6f-43be-9e98-a0edb8d529c8"
/> |
| _The “Sign-in methods” section moved to Account → Security. Note also
the new Admonition regarding the risk of a single (GitHub) sign-in
method._ |

## Review instructions

1. Open
[Security](https://studio-staging-git-dnywh-recovery-security-home-supabase.vercel.app/dashboard/account/security#sign-in-methods).
Check sign-in methods appear above MFA and recovery codes. With MFA off,
“Set up MFA” should be primary.
2. Open Preferences. Sign-in methods should be absent unless Security is
disabled.
3. On a test account, check password setup, email editing and provider
linking. [Open password setup
directly](https://studio-staging-git-dnywh-recovery-security-home-supabase.vercel.app/dashboard/account/security?securityAction=set-password#sign-in-methods),
then cancel and confirm it stays closed.
2026-11-09 17:42:43 +11:00
Danny White b83ad78d77 feat(studio): show recovery code health in account security (#52355)
## Problem

Users can run out of recovery codes without a clear warning that they
have lost a backup way to sign in.

## Solution

Show a warning when codes are running low or used up, with Regenerate
beside the code count. When MFA is enabled but codes are missing,
explain how to generate them. Keep recovery codes hidden until MFA is
enabled.

Remove standalone code deletion. Users can regenerate codes while MFA is
enabled.

| Before | After |
| --- | --- |
| <img width="1024" height="682" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/1c7a4c52-00c9-4c31-8b3a-ef0599555a1a"
/> | <img width="1024" height="682" alt="81082"
src="https://github.com/user-attachments/assets/ae662802-4fab-4c93-a5cb-52ed39d16f87"
/> |
| _3/10 codes left._ | _3/10 codes left._ |
| <img width="1024" height="682" alt="21450"
src="https://github.com/user-attachments/assets/82049f44-2fca-4477-84bf-23ab009868be"
/> | <img width="1024" height="682" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/e2185026-af6a-42a5-bc10-b587e3d2d4ab"
/> |
| _0/10 codes left._ | _0/10 codes left._ |

## Review instructions

1. Open [Recovery
codes](https://studio-staging-git-dnywh-recovery-code-health-supabase.vercel.app/dashboard/account/security#recovery-codes)
with one authenticator and generated codes.
2. In DevTools, override GET `/factors/recovery-codes`: keep the other
fields, set `remaining` to `0`, save and reload. Check the warning.
Repeat with `3`, then restore the response.
3. With MFA off, check that the Recovery codes section is hidden.
Disable overrides before using Regenerate.
2026-11-09 17:34:51 +11:00
Danny White 52cc917752 feat(studio): clarify authenticator setup and backup status (#52354)
## Problem

MFA setup and backup status are difficult to scan, and unverified
factors can appear as configured authenticators.

## Solution

- Show only verified authenticators (non-abandoned setup), with a clear
setup state when none are configured.
- Show backup guidance from the shared recovery checks and emphasise the
most relevant MFA action once those checks succeed.
- Align authenticator rows with the existing controls, use removal icons
with tooltips, and prevent removal when recovery-code status cannot be
confirmed.

| Before | After |
| --- | --- |
| <img width="1024" height="759" alt="7693"
src="https://github.com/user-attachments/assets/1deb07ef-91ce-481b-87f6-4baa7b023f94"
/> | <img width="1024" height="759" alt="18215"
src="https://github.com/user-attachments/assets/f17248a2-2001-4d95-ba28-3f16b75af0fb"
/> |
| <img width="1024" height="759" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/ede61c84-0baa-4139-9773-0953a05cbd94"
/> | <img width="1024" height="759" alt="14038"
src="https://github.com/user-attachments/assets/58ab1a70-0392-4706-8df3-2ba078c5a8ba"
/> |


## Review instructions

1. Open [MFA
settings](https://studio-staging-git-dnywh-recovery-mfa-status-supabase.vercel.app/dashboard/account/security#mfa)
without a verified authenticator. Confirm the setup empty state offers
“Set up MFA”.
2. Use an account with one authenticator and healthy codes. Check the
backup warning, aligned icon row, and remove tooltip.


## Validation

14 focused tests passed, including Auth SDK network responses and failed
recovery-status reads keeping removal unavailable. Formatting passed.
Focused ESLint passed with the locally incompatible TanStack
exhaustive-deps rule disabled; standard lint is blocked by the installed
plugin rejecting the current rule options. Full local typecheck still
reports errors in untouched panel and MCP files; none remain in this
PR's changed files.
2026-11-09 17:34:51 +11:00
Danny WhiteandJoshen Lim c7b49e2b1b feat(studio): resume account actions after recovery-code verification (#52747)
## Problem

Recovery-code verification uses a separate sign-in layout and returns
users to Security without resuming the selected action.

## Solution

Visually align with other security checks: use InterstitialLayout and
return to the selected authenticator’s removal confirmation. Cancel
returns to Security without signing out. Verification never removes the
authenticator automatically.

| Before | After |
| --- | --- |
| <img width="1280" height="1323" alt="Supabase"
src="https://github.com/user-attachments/assets/404e7b6d-6fe6-492a-b853-dc3b13b8f767"
/> | <img width="1280" height="1323" alt="47214"
src="https://github.com/user-attachments/assets/0100cf2f-3252-4f5c-a3a6-17bb0d81dfa5"
/> |

| After |
| --- |
| <img width="1280" height="1323" alt="45032"
src="https://github.com/user-attachments/assets/584254e2-0772-4dae-a0e5-9be6a8f99239"
/> |
| _Loading state._ |
| <img width="1280" height="1323" alt="8565"
src="https://github.com/user-attachments/assets/6d14459d-f172-4338-a021-fb5721649fda"
/> |
| _Standard unfilled state._ |
| <img width="1280" height="1323" alt="47304"
src="https://github.com/user-attachments/assets/83eca080-0fb6-4b3e-a52b-0110c6f8714a"
/> |
| _Error state. I’ve removed `font-mono` since this screenshot._ |

This PR also includes the _Use recovery code instead_ option into the
prior PR’s _Verify your identity_ interstitial:

| After |
| --- |
| <img width="1280" height="763" alt="6526"
src="https://github.com/user-attachments/assets/a05e3bc5-061d-4297-9fd0-e456dba44d4a"
/> |
| _Addition of the _Use recovery code instead_ button._ |


## Review instructions

Use a disposable MFA account with saved recovery codes. Successful
verification consumes one code.

1. Open [Security on this
preview](https://studio-staging-git-dnywh-recovery-code-verification-supabase.vercel.app/dashboard/account/security).
Follow [#52352’s breakpoint
steps](https://github.com/supabase/supabase/pull/52352#review-instructions)
on this preview to show Verify your identity. Remove the breakpoint
before continuing.
2. Choose Use a recovery code instead. Check the code visibility control
and an invalid-code error, then enter a valid saved code. The selected
authenticator’s removal confirmation should open. Nothing is deleted
until you click Remove.
3. Repeat and Cancel on the recovery-code screen. Return to Security and
remain signed in.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-09 16:35:32 +11:00
Danny WhiteandJoshen Lim 1052d414ad fix(studio): verify identity before removing authenticators (#52352)
## Problem

Authenticator removal can fail when the session has not completed MFA.

This is difficult to test (see below) but shows an awkward toast with
unclear “AAL1” and ”AAL2” copy, which is unhelpful to the user.

## Solution

Checks the session before removal confirmation. If needed, shows _Verify
your identity_ first.

Depends on #52351. Badge presentation: #52748. Recovery-code
verification: #52747.

| After |
| --- |
| <img width="814" height="725" alt="Security Account Supabase"
src="https://github.com/user-attachments/assets/8d0dc002-3777-4ba5-a4bc-9d98a059c2c4"
/> |
| _Unfilled state._ |
| <img width="814" height="725" alt="63727"
src="https://github.com/user-attachments/assets/5472de19-99b6-4403-aaca-f92e319445cb"
/> |
| _Errored state._ |
| <img width="814" height="725" alt="27157"
src="https://github.com/user-attachments/assets/f8480f0b-5cc4-432f-b38f-79cd311274cf"
/> |
| _What the above (success state) unlocks: being able to remove
authenticator._ |

## Review instructions

Use a disposable MFA account and sign in normally.

1. Open [Security locally](http://localhost:8082/account/security) (so
the breakpoint feature can be used). Click Delete beside an
authenticator. Since you already entered an MFA code at sign-in, removal
confirmation should open directly. Cancel keeps the authenticator. Click
Cancel.
2. To show verification, open DevTools → Sources → ⌘P. Find
`mfa-authenticator-assurance-level-query.ts`. Inside
`getMfaAuthenticatorAssuranceLevel`, click the line number beside
**`return data`** to add a breakpoint, then (back in the Studio
interface) click Delete.
3. When Paused in debugger appears, press Esc for the Console drawer (in
DevTools) and run `data.currentLevel = 'aal1'`. Remove the breakpoint by
clicking its line number again, then press F8 or Resume ▶ (at the top of
Studio in the yellow strip).
4. Try an invalid authenticator code, then a valid one. Verification
must lead to a separate removal confirmation. Cancel must keep the
authenticator.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-09 16:35:31 +11:00
Danny White ed03223f5a fix(studio): preserve authenticator removal progress on failure (#52351)
## Problem

Failed authenticator removal shows a toast and can repeat completed
steps on retry. A failed recovery-code status check can also allow
removal before Studio knows whether codes exist.

## Solution

Show errors below the dialog content, preserve removal progress on
retry, and block removal until recovery-code status is known. Add Retry
for failed status checks.

| After |
| --- |
| <img width="1450" height="458" alt="CleanShot 2026-11-04 at 15 34
41@2x"
src="https://github.com/user-attachments/assets/98989ad0-9b43-4203-95e4-1767346f2a8e"
/> |
| _Retry action._ |
| <img width="1514" height="246" alt="CleanShot 2026-11-04 at 15 16
37@2x"
src="https://github.com/user-attachments/assets/969b6525-c380-4a8a-9826-58bfe04887f8"
/> |
| _Blocked `recovery-codes` means user cannot delete MFA._ |
| <img width="1088" height="1040" alt="CleanShot 2026-11-04 at 15 18
08@2x"
src="https://github.com/user-attachments/assets/08e6631f-e90e-4719-bd0b-6360d5871d48"
/> |
| _If `recovery-codes` becomes unavailable after dialog is open, show
the error inline (not as a toast)._ |

## Review instructions

Use a disposable MFA account with recovery codes. Successful removal
deletes the authenticator and, if it was the last, its codes.

1. Open
[Security](https://studio-staging-git-dnywh-recovery-removal-errors-supabase.vercel.app/dashboard/account/security).
In DevTools Network, right-click GET `/factors/recovery-codes` → Block
request, then reload. Confirm removal is disabled. Unblock and click
Retry to enable it.
2. Open the removal dialog, then block the same request without
reloading. Click Remove: the error should appear below the content.
Unblock and retry: removal should succeed.
2026-11-09 16:35:31 +11:00
Danny White 156738417b fix(studio): centre the account recovery interstitial (#53073)
## Problem

The account recovery interstitial sits too high on tall screens because
it overrides the shared layout with fixed top padding.

## Solution

Use the shared interstitial layout's vertical centring for the reminder,
loading and unavailable states.

| Before | After |
| --- | --- |
| <img width="1451" height="957" alt="69167"
src="https://github.com/user-attachments/assets/b473a983-93a9-4c57-866c-5ce6dd02dddf"
/> | <img width="1280" height="1323" alt="Organizations Supabase"
src="https://github.com/user-attachments/assets/fe0af974-36fb-4edf-adfd-abfa75c22038"
/> |

## Review instructions

1. Use this PR's
**[studio-staging](https://studio-staging-git-dnywh-fixrecovery-interstiti-efb132-supabase.vercel.app/)**
preview with `enableAccountRecoveryInterstitial` and
`enableAuthRecoveryCodes` enabled. Sign in with a non-SSO test account
that has MFA but no recovery codes, and complete MFA verification.
2. If the account has previously skipped the reminder, remove its
`account-recovery-reminder:<user-id>` entry from local storage on this
preview origin, then reload.
3. Open `/dashboard/organizations` The reminder appears over the
dashboard after its background checks finish. Confirm the card is
vertically centred on a tall desktop viewport.
4. Use a narrow viewport, a short viewport and 200% browser zoom.
Confirm all content and **Skip for now** remain reachable by scrolling
when needed. Skip rather than generating codes if you do not want to
change the test account.
2026-11-09 10:23:06 +11: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
Danny White fdab2cc751 feat(studio): interrupt serious account recovery gaps (#51643)
## Problem

Users with serious recovery gaps may never visit Account Security, so a
manually accessible reminder is easy to miss.

## Solution

Show the existing reminder as a full-screen layout takeover after
required MFA verification and successful account reads. Keep the
original URL, query and fragment intact. The dashboard stays mounted but
inert, preserving unsaved work; dismissal reveals it. Wait for existing
dialogs to close. Keep rollout gating, eligibility and snooze unchanged.
A successfully resolved background check dismisses an untouched
takeover; started tasks and completed rows remain until Continue.


Both of these recovery flags are enabled via ConfigCat for local and
staging:
- `enableAccountRecoveryInterstitial`: this work
- `enableAuthRecoveryCodes`: the work it depends on

We’ll only flip these to `true` for production once all of this is
merged and heavily tested.

| Interruption Example |
| --- |
| <img width="654" height="800" alt="16563"
src="https://github.com/user-attachments/assets/eec71acf-78ab-473d-a9d3-9c6cdc3aff07"
/> |

The dashboard remains usable while eligibility loads. An open takeover
stays in place through background refreshes. Signing out clears
in-memory reminder state so clearing browser snooze permits retesting.

## Review instructions

1. Open [this PR’s staging
preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations)
with a non-SSO test account and complete required MFA verification.
Check `enableAccountRecoveryInterstitial` and `enableAuthRecoveryCodes`
are both true in the staging dev toolbar. Close the toolbar and other
dialogs.
2. **Exhausted codes:** use an account with existing codes and exactly
one verified authenticator. Override GET `/factors/recovery-codes` in
DevTools Network: retain JSON fields, set `remaining` to `0` and save.
Clear `account-recovery-reminder:<userId>` from Local Storage for this
preview origin, then reload. Make sure you are **not** on
`dashboard/account/security` as that won’t show the interstitial.
Confirm the request uses the override and the takeover opens without
changing the URL.
3. **Missing codes, separate scenario:** disable overrides and use an
MFA test account with no generated codes. Clear snooze and reload. A
zero remaining count simulates exhausted codes, not missing codes. A
second verified authenticator prevents the exhausted-code trigger, but
not the missing-code trigger.
4. Skip, reload and switch projects or organisations. Confirm snooze
persists. A different account must have separate reminder state. For
warning-to-critical escalation, generate codes on the missing-code
account, then override its remaining count to zero and reload without
clearing the warning snooze.
5. Disable overrides before live actions. Save codes or add an
authenticator, then Continue. Confirm the page and URL remain intact.
Tab and Command/Ctrl+K must not reach dashboard controls; nested dialogs
must still work. Editor draft and browser-history preservation are also
covered by component tests.
6. With snooze cleared, open a project URL containing a query and
fragment; opening and dismissing the takeover must leave that full URL
unchanged. Check account settings, sign-in, MFA verification and
consent/connection flows remain uninterrupted. A healthy account, failed
reads or a disabled rollout flag must not trigger a takeover.
7. Throttle the status request: the dashboard stays usable while
eligibility loads. If another dialog is already open, the takeover waits
until it closes. There is no standalone recovery route or runtime mock
parameter.
2026-10-27 12:42:05 +11:00
Danny White e2ec13d9a6 feat(studio): snooze recovery reminders per browser (#52124)
## Problem

Skipped recovery reminders need a consistent reminder interval for each
signed-in person in the browser.

## Solution

Snooze missing codes for thirty days and exhausted codes for seven days.
Escalation breaks snooze; sign-out preserves it. Completing codes, or
adding a backup factor for exhausted codes, resolves the applicable gap.
Track task actions, completion and dismissal.

## Review instructions

**This PR’s own deploy preview cannot show the takeover.** Review its
diff here, but test the assembled stack on [#51643’s staging
preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations).
The controller only mounts in #51643.

Before each scenario: use a non-SSO staging test account with MFA
verified; check `enableAccountRecoveryInterstitial` and
`enableAuthRecoveryCodes` are both true in the staging dev toolbar, then
close the toolbar and other dialogs. Clear
`account-recovery-reminder:<userId>` from DevTools Application → Local
Storage **for that preview origin**, then reload the dashboard.

1. Use an account with existing codes and exactly one verified
authenticator. Override GET `/factors/recovery-codes` in DevTools
Network: retain JSON fields, set `remaining` to `0`, save and reload.
Confirm the overridden request succeeds and the takeover opens.
2. Skip. Confirm the URL stays unchanged and the local-storage record
has critical severity with expiry seven days ahead. In a separate
scenario, genuinely missing codes should record warning severity with
expiry thirty days ahead.
3. Reload, switch projects or organisations, then sign out and back in.
The reminder stays hidden. Clear the record and reload to retest.
4. Disable overrides before live actions. Save codes and Continue; the
record clears. Adding a second authenticator resolves exhausted codes
but must not resolve missing codes. Use separate test accounts for these
cases.
2026-10-27 12:42:05 +11:00
Danny White eec2d0f947 feat(studio): offer a backup authenticator in the recovery reminder (#52123)
## Problem

A recovery reminder should let users save codes and add a backup
authenticator independently, with clear loading and completed states.

## Solution

Add an optional authenticator task for accounts with one verified
factor. Keep completed rows visible, use text shimmers while loading,
and dismiss an untouched takeover when a successful refresh confirms the
gap is resolved. Continue and Skip dismiss through the same callback
used by the layout takeover.

| State | Screenshot |
| --- | --- |
| Loading | <img width="654" height="800" alt="40913"
src="https://github.com/user-attachments/assets/d75585f0-5d00-46db-9ec7-1305da0f7464"
/> |
| Multiple issues | <img width="654" height="800" alt="Supabase"
src="https://github.com/user-attachments/assets/8342667c-ecce-4271-a418-41295ebba223"
/> |
| One issue fixed | <img width="654" height="800" alt="15927"
src="https://github.com/user-attachments/assets/693c37fe-e955-4c9d-b866-1c60743a31b8"
/> |
| Both issues fixed | <img width="654" height="800" alt="59618"
src="https://github.com/user-attachments/assets/46140e95-b686-41ab-a5ea-94016f7eda29"
/> |

## Review instructions

**This PR’s own deploy preview cannot show the takeover.** Review its
diff here, but test the assembled stack on [#51643’s staging
preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations).
The controller only mounts in #51643.

Before each scenario: use a non-SSO staging test account with MFA
verified; check `enableAccountRecoveryInterstitial` and
`enableAuthRecoveryCodes` are both true in the staging dev toolbar, then
close the toolbar and other dialogs. Clear
`account-recovery-reminder:<userId>` from DevTools Application → Local
Storage **for that preview origin**, then reload the dashboard.

1. Use a test account with missing codes and exactly one verified
authenticator. Cancel Add authenticator, then reopen and enrol a test
authenticator. Confirm only that row completes and Skip for now becomes
Continue. Generate and acknowledge codes; both completed rows stay
visible. These actions change the test account.
2. **Separate exhausted-code scenario:** use an account that still has
exactly one verified authenticator. Override GET
`/factors/recovery-codes` in DevTools Network: retain JSON fields, set
`remaining` to `0`, clear snooze and reload. An account with two
verified authenticators will not trigger for exhausted codes. Disable
overrides before live actions.
3. For the codes-only layout, use an account with two verified
authenticators and genuinely missing codes. Repeat at a narrow viewport.
Loading, unavailable and externally resolved states have component-test
coverage; healthy or failed reads must not trigger a takeover.
2026-10-27 12:29:11 +11:00
Danny White 749386567d feat(studio): fix recovery codes inside an interstitial (#52122)
## Problem

Users need to fix missing or exhausted recovery codes without leaving
the recovery reminder.

## Solution

Add a reusable recovery reminder and full-screen modal shell using the
existing recovery-code dialogs. Dismissal is a callback. The automatic
layout gate in #51643 mounts the UI; there is no standalone preview
route.

| State | Screenshot |
| --- | --- |
| Blocked request | <img width="654" height="800" alt="39307"
src="https://github.com/user-attachments/assets/2ba80ea7-24ad-4d29-ab50-730890501014"
/> |
| Recovery codes used up | <img width="654" height="800" alt="Supabase"
src="https://github.com/user-attachments/assets/5dd63735-1254-4855-bbd8-04c2e4c699fa"
/> |
| No recovery codes | <img width="654" height="800" alt="Supabase"
src="https://github.com/user-attachments/assets/58ff5b91-7da6-4c39-ad99-cea7cce8cf73"
/> |
| Recovery codes saved (just completed above _Generate codes_ step) |
<img width="654" height="800" alt="63500"
src="https://github.com/user-attachments/assets/1fc7ca56-a7cb-4edd-a3cd-4d8cf5c09659"
/> |


## Review instructions

**This PR’s own deploy preview cannot show the takeover.** Review its
diff here, but test the assembled stack on [#51643’s staging
preview](https://studio-staging-git-dnywh-account-recovery-interstitial-supabase.vercel.app/dashboard/organizations).
The controller only mounts in #51643.

Before each scenario: use a non-SSO staging test account with MFA
verified; check `enableAccountRecoveryInterstitial` and
`enableAuthRecoveryCodes` are both true in the staging dev toolbar, then
close the toolbar and other dialogs. Clear
`account-recovery-reminder:<userId>` from DevTools Application → Local
Storage **for that preview origin**, then reload the dashboard.

1. **Exhausted codes:** use an account with existing codes and exactly
one verified authenticator. In DevTools Network, right-click GET
`/factors/recovery-codes` → **Override content**. Keep the JSON fields,
set `remaining` to `0`, save and reload. Confirm the request shows the
overridden response and the takeover opens.
2. **Missing codes, separate scenario:** disable overrides and use an
MFA test account with no generated codes. Clear snooze and reload.
Setting `remaining` to `0` simulates exhausted codes, not missing codes.
3. Disable overrides before live actions. Cancel regeneration to check
existing codes remain intact, then generate or regenerate codes and
acknowledge storage. These actions change the test account. Continue or
Skip should reveal the unchanged URL and page.
2026-10-27 12:29:10 +11:00
Danny WhiteandJoshen Lim df8aca1fb2 refactor(studio): share recovery setup dialogs (#52121)
## Problem

The same recovery setup needs to work from Account Security and the new
recovery interstitial without duplicating dialog behaviour.

## Solution

Share the generation and regeneration flow, and report completion only
after codes are acknowledged or an authenticator is verified. Keep the
existing Account Security entry points. This PR provides the dialog
foundation; #52122 and #52123 consume its callbacks, and #51643 mounts
the takeover.

## Review instructions

1. Open [Account
Security](https://studio-staging-git-dnywh-recovery-shared-dialogs-supabase.vercel.app/dashboard/account/security)
in staging, or `/account/security` locally, using a disposable test
account.
2. Generate recovery codes. Confirm Done stays disabled until the save
acknowledgement is checked, then closes the dialog.
3. Regenerate codes. Cancel the confirmation first and confirm nothing
changes; repeat and confirm the replacement codes appear.
4. Open Add authenticator and cancel. Then complete enrolment with a
test authenticator; confirm it appears only after verification.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-10-27 12:29:10 +11:00
Charis 9391f60ec9 test(studio): add shared permissions mocks and testGrant helper (#52312)
## Problem

Components and fetchers are moving to endpoint-bound FGA grants, so more
tests need to mock `/platform/profile/permissions/v2` and mint grants.
Each test file currently defines its own permissions response type and
mock, and `testGrant` lives inside `guarded-fetch.test.ts`.

Resolves
[FE-4692](https://linear.app/supabase/issue/FE-4692/test-infra-global-msw-handler-for-v2-permissions-and-testgrant).

## Solution

* `tests/lib/permissions-fixtures.ts`: shared `PermissionsV2Response`
type, `ALL_FGA_PERMISSIONS`, `allPermissionsFor(slugs)` (grants
everything at the org level), and `NO_PERMISSIONS`.
* `tests/lib/msw-permissions.ts`: `mockPermissions(response)` and
`mockPermissionsError({ status, message })` on top of `addAPIMock`.
* `tests/lib/test-grant.ts`: `testGrant(endpoint, { variant,
organizationSlug, projectRef, permissionsProjectRef })` for unit tests
of fetchers and query options, moved out of `guarded-fetch.test.ts`.
* Existing tests that mocked the v2 endpoint now use the shared helpers.
`IndirectTaxDeclarationModal.test.tsx` keeps its own `addAPIMock`
because a test asserts the request was served.
* Documented in `apps/studio/tests/README.md` and the
`studio-mock-api-tests` skill.
2026-10-26 10:51:20 -04:00
Joshen Lim 60b51d74d5 Audit existing unit tests + Remove redundant ones (#52215)
## Context

_TLDR: Changes here speeds up unit tests on CI from ~14 minutes to ~3
minutes_ 😂
_TLDR 2: The file changes are solely only test files +
`studio-unit-tests.yml`_

We've currently got a lot of unit tests in the repository which while
great for coverage, hasn't been ideally written. There's a lot of
redundancy + overly specific tests that break easily, and our current
unit test takes about 15 minutes to run in the GHA per PR. Hence am
doing a audit clean up of all existing unit tests in the studio repo.

## Changes involved
- `.test.ts` files now run in `node`, `.test.tsx` in `jsdom`
- jsdom costs about 1s of setup per file. A `.ts` test that needs the
DOM opts in with `// @vitest-environment jsdom` (46 files do).
- Removed redundant and over-specific tests
- Duplicates are merged into `test.each`. Tests that only covered
libraries, existed for coverage, or asserted class names and snapshots
are deleted. 19 files are merged into a sibling or deleted.
- Fixed about 15 tests that couldn't fail 
- Examples: unawaited assertions, fixtures equal to the default, and a
`semverGte` test calling `semverLte`.
- Sped up the slowest files 
- Real sleeps are replaced with fake timers, `user.type` with paste, and
Radix option queries are scoped to the open listbox. For example,
`RestoringState` went from 18s to 0.3s and
`useTableEditorFiltersSort.navigation` from 20s to 3s.
- These ^ already shave down the unit tests time from 14 mins to 9 mins,
but am also sharding unit tests across 4 jobs to increase speed up
further which then shaves down time to 3 mins now
2026-10-23 18:51:27 +08:00
fffb1e23ca feat: implement profile permissions v2 api (#50966)
## Problem

Migrating Studio's permission checks from the old RLS json logic to
openfga backed permissions.

### New hooks and helpers

- `usePermissionsQueryV2` fetches the new profile openfga permisisons 
- `useAsyncCheckPermissionsV2` the replacement for the old check hook;
takes an FGA permission string (or a list)
- `FGA_PERMISSIONS` permission constants derived from
`@supabase/shared-types`. At the moment, the hook also accepts plain
strings for permissions not yet published in the package
- `useAsyncCheckUserContentPermissions` new hook for permission checks
on user content (SQL snippets, reports, log snippets). This wraps
``useAsyncCheckPermissionsV2` and adds existing content level rules on
top of the fga permission check

### Notes

- ~~Need api to support new permissions: project_operations_write,
billing_read/write, audit_logs_read~~ [DONE]
- ~~Still need to support: organization_config_read/write, auth hooks
and users permissions~~ [DONE]

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2026-10-21 06:54:16 -04:00
Joshen Lim 1ddb9ac787 Refactor organization audit logs to use filter bar (#51921)
## Context

Related to this PR
[here](https://github.com/supabase/supabase/pull/51790), gonna refactor
the Organization audit logs UI to also use the FilterBar component to
match a consistent UX across log surfaces, instead of the individual
filter popovers.

<img width="1450" height="684" alt="image"
src="https://github.com/user-attachments/assets/c1a4aab3-59d0-46a5-b7c7-1e7a5ad86b0d"
/>


### For design

Adding a small update to the `FilterBar` component here with a
`topLevelOnly` parameter if the component is being used with
`supportsOperators` (nested groups)
- In the case of AuditLogs as least, figured that the date range filter
option only makes sense as a top level filter
- Hence this prevents the date range filter from being selectable while
managing filters within a group

<img width="366" height="186" alt="image"
src="https://github.com/user-attachments/assets/e34ea0c8-5f03-4115-9fb1-554612f148dd"
/>
2026-10-20 14:52:40 +08:00
Joshen Lim 17f21bf6a8 Joshenlim/fe 4510 auditlogs filterbar for account logs (#51790)
## Context

Replaces the individual filters on the Account audit logs page with the
filter bar to match a consistent UX across log surfaces
<img width="1206" height="360" alt="image"
src="https://github.com/user-attachments/assets/c5bdfd7e-3277-4695-b9fc-1791df8720c7"
/>

Also uses the `supportOperators` param for the `FilterBar` to support
"OR" based operations when filtering for projects
<img width="1219" height="97" alt="image"
src="https://github.com/user-attachments/assets/d4748e6c-d1f3-4f23-b767-e0f4bb1c0a1c"
/>

The main changes for the `FilterBar` component made in this PR (which
would be more relevant for the design team) are:
- Added a divider between the options and "New group" 
  - Originally didn't have a divider
- So there's a clearer distinction that the "New group" isn't a option
to set as the value for
- Add a new `defaultGroupOperator` prop
  - Originally defaults to `AND`
- However, in the context of Audit Logs when filtering for projects,
you'd expect `OR` to be the default to filter across several projects
(`AND` wouldn't make sense here)
2026-10-16 13:30:19 +08:00
Gildas GarciaandJoshen Lim c829b26bd5 (feat) Allow to filter organization users by role (#51653)
## Problem

It can be hard to verify users roles in organizations with many members

## Solution

Add a filter on the team pages for organization roles.
<img width="1174" height="310" alt="image"
src="https://github.com/user-attachments/assets/dfc2ccdc-b83e-45c5-9a6c-d50417a3ff3e"
/>

## Review instructions

- Open the organization team page
- Select a role and verify only members who have this role are displayed
- Ensure other filters still work

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-10-15 11:31:46 +02:00
Charis cfdc81e1fe test(studio): raise timeout for NewScopedTokenSheet tests (#51755)
## Summary

- The `NewScopedTokenSheet` tests were flaky on master. The 5s default
timeout was hit intermittently, most visibly in the "falls back to
Custom when a row diverges from the preset" test, plus some sibling
tests.
- Observed in unit-test runs on master. Reproduced locally by running
the file under heavy CPU load, where tests took 4.5-5s versus ~1s on an
idle machine.
- Fix: file-level `vi.setConfig({ testTimeout: 15_000 })`. This only
affects this file because vitest isolates test files.

## Testing

- Ran the file 5 times under the same CPU load. All 21 tests passed each
time.
2026-10-14 14:30:41 -04:00
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00
Joshen Lim fe8b4df66d Chore/tiny refactor org limit (#51550)
## Context

Tiny refactor that I happened to pass by as I was reviewing other PRs

`useOrgProjectsInfiniteQuery` has a default `limit` value at 96 set in
the hook, 96 mainly for the home page to render a full row of cards
since cards are rendered in rows of 3

However, we have a couple of callsites for `useOrgProjectsInfiniteQuery`
that were passing a different `limit` value, hence these would be
triggered as a separate API request.

Am opting to remove the `limit` parameter from
`useOrgProjectsInfiniteQuery` so that the limit is standardized to 96
- So that data can be cached without having to invoke another API
request wherever `useOrgProjectsInfiniteQuery` is called
- I doubt that there'll be a need in a UI that will require calling
`useOrgProjectsInfiniteQuery` with a separate value for `limit` but
please do let me know otherwise if I might be overlooking anything!
2026-10-13 11:06:49 +08:00
Gildas GarciaandJoshen Lim 88bc1ac384 feat(studio): oauth apps users own grant list in account settings (#50903)
## Purpose

Users now have an _apps_ page in their account settings allowing them to
see their own grants, the projects they affect and to disconnect an app.

This PR only uses mock data. Besides, the page and menu item are behind
a feature flag enabled on staging

<!--
## Preview links

If relevant, include links to changed pages for easy review access.

Copy the preview base URL from the Vercel bot comment on this PR. Use
the following table as an example template.

| Site | Live | Preview | Search for |
| -------------- |
-------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
| ----------------------------- |
| WWW | [/blog/your-post](https://supabase.com/blog/your-post) |
[/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post)
| unique phrase from the change |
| Docs |
[/docs/guides/your-page](https://supabase.com/docs/guides/your-page) |
[/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page)
| unique phrase from the change |
| Studio | [/dashboard](https://supabase.com/dashboard) |
[/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard)
| unique phrase from the change |
| Design system | [/design-system](https://supabase.com/design-system) |
[/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system)
| unique phrase from the change |
| UI library | [/library](https://supabase.com/library) |
[/library](https://ui-library-git-branch-name-supabase.vercel.app/library)
| unique phrase from the change |
| Knowledge base |
[/kb/guides/your-page](https://supabase.com/kb/guides/your-page) |
[/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page)
| unique phrase from the change |
-->

<!-- ## Additional context

Optionally add any other context or screenshots.

-->

## Review instructions

- In _Account/OAuth Apps_, you should see a list of apps
<img width="748" height="359" alt="image"
src="https://github.com/user-attachments/assets/8c50a467-e2c1-4000-aecf-09d5db1591d3"
/>
- Each app should have a menu entry allowing to disconnect it (fake for
now)
<img width="587" height="278" alt="image"
src="https://github.com/user-attachments/assets/6221fbd6-3b61-4d93-903e-9aedaf94de3f"
/>
- Each app but the last should have a menu entry that opens a dialog to
see the connected projects
<img width="657" height="651" alt="image"
src="https://github.com/user-attachments/assets/e985f933-fdfb-4d28-93c3-b3678d7d8a53"
/>

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-10-12 10:15:33 +02:00
Jordi EnricandJoshen Lim d1e0b551c5 fix(studio): show correct timezone offsets FE-4612 (#51484)
## Problem

Restore timezone labels use fixed UTC offsets from the timezone catalog.
Madrid displays UTC+01:00 during daylight saving time even though the
reported restore timestamp correctly uses UTC+02:00.

## Fix

Calculate display offsets from the restore instant and the timezone's
IANA identifier using Intl. Apply the same formatter to dropdown
options, the selected timezone, and PITR confirmation while preserving
existing restore calculations and timezone selection identity.

Fixes https://linear.app/supabase/issue/FE-4612

## How to test

- Choose Madrid in restore-to-new-project or PITR and compare winter and
summer restore dates. Expected result: UTC+01:00 in winter and UTC+02:00
during daylight saving time, including the confirmation label.
- Check UTC, New York, Kolkata, and Kathmandu. Expected result: correct
zero, negative, and fractional offsets.
- Focused Vitest suite: 15 tests passed, including both Madrid DST
boundaries and timestamp preservation. The component test verifies
visible trigger and option labels update after a date change, Madrid
search results, selection preserving the original timezone object, and
popover closure. It also passes under UTC and Hong Kong browser
timezones. Prettier and diff checks passed.
- All CI checks passed for the latest commit, including Studio tests,
all four Next.js/TanStack E2E shards, typecheck, lint ratchet,
formatting, spelling, unused-code checks, and Docker build. Full local
typecheck and ESLint validation were blocked by the shared dependency
installation being out of sync with this checkout.

Calculation audit confirmed the reported October 9 Madrid 05:12 to UTC
03:12 conversion. Separate existing date-control issues were found when
browser and restore timezones differ and around the repeated autumn
hour; those are outside this label fix and relevant to FE-4129.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-10-12 14:36:48 +08:00
Danny WhiteandJoshen Lim 78dc739901 fix(studio): show support inline and honour AlertError layouts (#51377)
## Problem

AlertError forces a vertical layout whenever additional actions are
supplied, even when the caller explicitly requests horizontal or
responsive layout. Stripe Sync Engine's uninstall error is one affected
call site, the other was Pipelines as demoed in #51311.

## Solution

Honour an explicit layout. Preserve the existing defaults: vertical with
additional actions, responsive otherwise.

Replace the standalone Contact support action with an InlineLink in the
contact support prose, preserving support form context and breadcrumb
capture. Keep custom actions such as Retry. If instructions are hidden
or custom prose omits contact support, retain a separate inline support
link. With `hideContactSupport`, show no support link and shorten the
default instructions to “Try refreshing your browser.” Custom
descriptions remain unchanged. The local Pipelines configuration error
explicitly hides support. Add the explicit responsive layout at the
Pipelines call site.

| Before | After |
| --- | --- |
| <img width="914" height="426" alt="CleanShot 2026-10-07 at 17 51
20@2x"
src="https://github.com/user-attachments/assets/6cbddfee-97f5-4a7a-bafa-7b5dfd6ab8bf"
/> | <img width="916" height="422" alt="CleanShot 2026-10-07 at 18 26
06@2x"
src="https://github.com/user-attachments/assets/a21952a6-1c1a-437c-af73-c5736f33fd98"
/> |
| <img width="1566" height="384" alt="CleanShot 2026-10-07 at 18 28
07@2x"
src="https://github.com/user-attachments/assets/bdc2a043-421f-4c22-9bd3-37859c6e85c7"
/> | <img width="1568" height="308" alt="CleanShot 2026-10-07 at 18 26
58@2x"
src="https://github.com/user-attachments/assets/da0f2c6a-6254-4196-944b-5665e87b3c3c"
/> |

## Review instructions

1. In a fresh local test project with no existing `stripe` schema, run
this in SQL Editor:

```sql
begin;
create schema stripe;
comment on schema stripe is
  '{"status":"uninstall error","errorMessage":"Local layout test: uninstallation failed"}';
commit;
```

2. Open **Integrations → Stripe Sync Engine → Overview** and reload.
Check **Failed to uninstall Stripe Sync Engine** at wide and narrow
widths, including **Retry uninstallation** and the inline **contact
support** link. Do not click Retry: it invokes the real uninstall
operation.
3. Remove the empty fixture with `drop schema stripe restrict;`.
4. Block the Pipelines source-status request and resize the page: Retry
uses the responsive layout.
5. AlertError callers without an explicit layout should retain their
existing presentation. Confirm default and custom contact support prose
use an inline link, with no standalone support action. Hidden
instructions and custom prose without contact support retain an inline
fallback. With `hideContactSupport`, the default prose is “Try
refreshing your browser.” and no support link appears; custom
descriptions remain unchanged.
6. Automated regression coverage checks that an explicit responsive
layout survives additional actions, and that hiding support removes the
default support wording while preserving custom descriptions.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-10-08 16:04:32 +11:00
Danny White 0cb8bd95dd feat(studio): add spot colour control to Appearance (#50782)
## Problem

The theme's primary hue can change in CSS, but Appearance had no way to
try other spot colours. That makes it hard to find controls whose colour
still depends on the fixed Supabase brand palette.

## Solution

Add a **Spot color** control under Appearance → Theme colors
(employee-only via ConfigCat `appearanceSpotColor`, targeted to Supabase
Team Email).

### Spot color UX
- Rainbow spectrum track with a thin outline so pale tracks stay visible
- Live trifecta swatches for `--primary-solid`, `--primary`, and
`--primary-bright` (darkest → lightest) next to the degree readout
- Drag updates are rAF-batched so React paint and CSS preview stay to
one frame

### Canvas tint coupling
- `--surface-hue` is derived in CSS as `calc(var(--primary-hue) +
var(--surface-hue-offset))`
- Dark: offset `0` (same hue as spot)
- Light: offset `180` (complementary canvas tint; brand green ≈157.5° →
rose ≈337.5°)
- No JS override of `--surface-hue`. Changing Spot color moves primary
controls and the low-chroma canvas tint together

### Other theme sliders
- Renamed **Color intensity** → **Surface tint** (it only drives the
neutral ramp via `--chroma`, not spot chroma)
- Meaning-shaped tracks for every knob (spectrum, grey→tint, soft→hard,
dark→light, flat→lift)
- Same outline treatment on those tracks

| Before | After |
| --- | --- |
| <img width="1476" height="2174" alt="CleanShot 2026-10-05 at 15 02
21@2x"
src="https://github.com/user-attachments/assets/d08b0fa8-32af-450e-adce-861f59c9d6ca"
/> | <img width="1474" height="2354" alt="CleanShot 2026-10-05 at 14 56
35@2x"
src="https://github.com/user-attachments/assets/9a1e6183-a4ba-4c8e-a458-bb0eea946db8"
/> |
| _Anyone else_ | _With staff flag, custom settings_ |

## Review instructions

1. Confirm ConfigCat flag `appearanceSpotColor` is on for your staff
account (or flip it in the Dev Toolbar).
2. Open `/account/me` → **Appearance → Theme colors**.
3. Without the flag: Spot color is hidden; other theme sliders still
work.
4. With the flag: drag Spot color in light and dark. Primary controls
and canvas tint should move together; Supabase brand assets should stay
fixed.
5. Raise Surface tint and confirm the canvas hue follows the
complementary (light) or same-hue (dark) offset.
6. Refresh, switch modes, and use **Reset** to check persistence and
defaults.
2026-10-06 10:11:26 +11:00