mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## 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.
30 lines
879 B
TypeScript
30 lines
879 B
TypeScript
import type { AccountRecoveryFinding } from '@/lib/account-recovery/evaluate-account-recovery'
|
|
|
|
export type SecurityAction = AccountRecoveryFinding['action'] | 'enable-mfa'
|
|
|
|
const findingOrder: AccountRecoveryFinding['id'][] = [
|
|
'recovery-codes-exhausted',
|
|
'recovery-codes-missing',
|
|
'recovery-codes-low',
|
|
'single-oauth-identity',
|
|
'single-mfa-factor',
|
|
]
|
|
|
|
export const getPrimarySecurityAction = ({
|
|
findings,
|
|
canEnableMfa,
|
|
isPending,
|
|
isError,
|
|
}: {
|
|
findings: AccountRecoveryFinding[]
|
|
canEnableMfa: boolean
|
|
isPending: boolean
|
|
isError: boolean
|
|
}): SecurityAction | undefined => {
|
|
if (isPending || isError) return undefined
|
|
const finding = findingOrder.map((id) => findings.find((item) => item.id === id)).find(Boolean)
|
|
if (canEnableMfa) return 'enable-mfa'
|
|
if (finding && finding.severity !== 'info') return finding.action
|
|
return finding?.action
|
|
}
|