Commit Graph
10 Commits
Author SHA1 Message Date
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 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 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 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 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
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