fix(app): failed sign-out reported (local session still cleared); reauthentication_needed phrased; docs(docs): exact production redirect allowlist
This commit is contained in:
1 parent
1aed64b4ef
commit
9771d997f4
7 files changed
+29
-5
No files matched your search
@@ -21,7 +21,7 @@ Implement Step 7 keeping the current visual identity (logo, palette, cream/white
|
|||||||
EXPECT: >= 4 ; passed
|
EXPECT: >= 4 ; passed
|
||||||
5. Server errors are never shown raw: every GoTrue error goes through classifyAuthError → AuthFailure kind → `auth.failure.<kind>` key present in fr and en for every kind of the union.
|
5. Server errors are never shown raw: every GoTrue error goes through classifyAuthError → AuthFailure kind → `auth.failure.<kind>` key present in fr and en for every kind of the union.
|
||||||
CHECK: sed -n '/^export type AuthFailureKind =/,/^$/p' packages/supabase/src/auth.ts | grep -o "| '[a-z_]*'" | sed "s/| '//;s/'//" | sort -u > "$TMPDIR/kinds.txt"; for k in $(cat "$TMPDIR/kinds.txt"); do grep -q "'auth.failure.$k'" apps/app/src/i18n/fr.ts && grep -q "'auth.failure.$k'" apps/app/src/i18n/en.ts || echo MISSING $k; done
|
CHECK: sed -n '/^export type AuthFailureKind =/,/^$/p' packages/supabase/src/auth.ts | grep -o "| '[a-z_]*'" | sed "s/| '//;s/'//" | sort -u > "$TMPDIR/kinds.txt"; for k in $(cat "$TMPDIR/kinds.txt"); do grep -q "'auth.failure.$k'" apps/app/src/i18n/fr.ts && grep -q "'auth.failure.$k'" apps/app/src/i18n/en.ts || echo MISSING $k; done
|
||||||
EXPECT: no MISSING line (12 kinds)
|
EXPECT: no MISSING line (13 kinds)
|
||||||
6. Email verification mandatory and password policy mirrored: config.toml enable_confirmations = true, minimum_password_length = 12, password_requirements lower_upper_letters_digits; client passwordSchema min 12 + the three classes.
|
6. Email verification mandatory and password policy mirrored: config.toml enable_confirmations = true, minimum_password_length = 12, password_requirements lower_upper_letters_digits; client passwordSchema min 12 + the three classes.
|
||||||
CHECK: grep -n "enable_confirmations = true\|minimum_password_length = 12\|lower_upper_letters_digits" supabase/config.toml | wc -l; grep -n "PASSWORD_MIN_LENGTH = 12\|\[a-z\]\|\[A-Z\]\|\[0-9\]" apps/app/src/auth/validation.ts | wc -l
|
CHECK: grep -n "enable_confirmations = true\|minimum_password_length = 12\|lower_upper_letters_digits" supabase/config.toml | wc -l; grep -n "PASSWORD_MIN_LENGTH = 12\|\[a-z\]\|\[A-Z\]\|\[0-9\]" apps/app/src/auth/validation.ts | wc -l
|
||||||
EXPECT: 3 ; >= 4
|
EXPECT: 3 ; >= 4
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ export default function SignOutButton({ className = '' }: { className?: string }
|
|||||||
setBusy(true)
|
setBusy(true)
|
||||||
try {
|
try {
|
||||||
await signOut()
|
await signOut()
|
||||||
|
} catch {
|
||||||
|
// The local session is cleared either way; the server may not have revoked the others.
|
||||||
|
window.alert(t('shell.sign_out_failed'))
|
||||||
} finally {
|
} finally {
|
||||||
// The guard would redirect anyway; going home keeps the local tool one step away.
|
// The guard would redirect anyway; going home keeps the local tool one step away.
|
||||||
navigate('/', { replace: true })
|
navigate('/', { replace: true })
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ export const en: Dict = {
|
|||||||
'Too many attempts. Wait a few minutes before trying again.',
|
'Too many attempts. Wait a few minutes before trying again.',
|
||||||
'auth.failure.link_expired': 'This link has expired or was already used.',
|
'auth.failure.link_expired': 'This link has expired or was already used.',
|
||||||
'auth.failure.session_expired': 'Your session has expired. Sign in again.',
|
'auth.failure.session_expired': 'Your session has expired. Sign in again.',
|
||||||
|
'auth.failure.reauthentication_needed':
|
||||||
|
'For security, sign out and sign in again before changing the password.',
|
||||||
'auth.failure.provider_disabled': 'This sign-in method is not enabled.',
|
'auth.failure.provider_disabled': 'This sign-in method is not enabled.',
|
||||||
'auth.failure.network': 'Cannot reach the server. Check your network.',
|
'auth.failure.network': 'Cannot reach the server. Check your network.',
|
||||||
'auth.failure.unknown': 'An unexpected error occurred. Try again.',
|
'auth.failure.unknown': 'An unexpected error occurred. Try again.',
|
||||||
@@ -289,6 +291,8 @@ export const en: Dict = {
|
|||||||
'shell.nav.local_tool_hint': 'No account, PDF export',
|
'shell.nav.local_tool_hint': 'No account, PDF export',
|
||||||
'shell.sign_out': 'Sign out',
|
'shell.sign_out': 'Sign out',
|
||||||
'shell.signing_out': 'Signing out…',
|
'shell.signing_out': 'Signing out…',
|
||||||
|
'shell.sign_out_failed':
|
||||||
|
'Signed out on this device, but the server did not confirm: your other sessions may stay open.',
|
||||||
'shell.loading_session': 'Checking your session…',
|
'shell.loading_session': 'Checking your session…',
|
||||||
'shell.role.owner': 'Platform owner',
|
'shell.role.owner': 'Platform owner',
|
||||||
'shell.role.admin': 'Administrator',
|
'shell.role.admin': 'Administrator',
|
||||||
|
|||||||
@@ -291,6 +291,8 @@ export const fr: Dict = {
|
|||||||
'Trop de tentatives. Patientez quelques minutes avant de réessayer.',
|
'Trop de tentatives. Patientez quelques minutes avant de réessayer.',
|
||||||
'auth.failure.link_expired': 'Ce lien a expiré ou a déjà été utilisé.',
|
'auth.failure.link_expired': 'Ce lien a expiré ou a déjà été utilisé.',
|
||||||
'auth.failure.session_expired': 'Votre session a expiré. Reconnectez-vous.',
|
'auth.failure.session_expired': 'Votre session a expiré. Reconnectez-vous.',
|
||||||
|
'auth.failure.reauthentication_needed':
|
||||||
|
'Par sécurité, déconnectez-vous puis reconnectez-vous avant de changer le mot de passe.',
|
||||||
'auth.failure.provider_disabled': "Ce mode de connexion n'est pas activé.",
|
'auth.failure.provider_disabled': "Ce mode de connexion n'est pas activé.",
|
||||||
'auth.failure.network': 'Connexion au serveur impossible. Vérifiez votre réseau.',
|
'auth.failure.network': 'Connexion au serveur impossible. Vérifiez votre réseau.',
|
||||||
'auth.failure.unknown': "Une erreur inattendue s'est produite. Réessayez.",
|
'auth.failure.unknown': "Une erreur inattendue s'est produite. Réessayez.",
|
||||||
@@ -305,6 +307,8 @@ export const fr: Dict = {
|
|||||||
'shell.nav.local_tool_hint': 'Sans compte, export PDF',
|
'shell.nav.local_tool_hint': 'Sans compte, export PDF',
|
||||||
'shell.sign_out': 'Se déconnecter',
|
'shell.sign_out': 'Se déconnecter',
|
||||||
'shell.signing_out': 'Déconnexion…',
|
'shell.signing_out': 'Déconnexion…',
|
||||||
|
'shell.sign_out_failed':
|
||||||
|
"Déconnecté sur cet appareil, mais le serveur n'a pas confirmé : vos autres sessions peuvent rester ouvertes.",
|
||||||
'shell.loading_session': 'Vérification de la session…',
|
'shell.loading_session': 'Vérification de la session…',
|
||||||
'shell.role.owner': 'Propriétaire plateforme',
|
'shell.role.owner': 'Propriétaire plateforme',
|
||||||
'shell.role.admin': 'Administrateur',
|
'shell.role.admin': 'Administrateur',
|
||||||
|
|||||||
@@ -137,9 +137,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
|||||||
},
|
},
|
||||||
|
|
||||||
signOut: async () => {
|
signOut: async () => {
|
||||||
await signOutRequest(requireClient())
|
const clear = () => set({
|
||||||
// SIGNED_OUT also arrives through the subscription; this keeps the UI honest if it does not.
|
|
||||||
set({
|
|
||||||
status: 'signed_out',
|
status: 'signed_out',
|
||||||
session: null,
|
session: null,
|
||||||
user: null,
|
user: null,
|
||||||
@@ -147,6 +145,13 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
|||||||
roles: [],
|
roles: [],
|
||||||
recovery: false,
|
recovery: false,
|
||||||
})
|
})
|
||||||
|
try {
|
||||||
|
// auth-js clears the local session even when the server call fails.
|
||||||
|
await signOutRequest(requireClient())
|
||||||
|
} finally {
|
||||||
|
// SIGNED_OUT also arrives through the subscription; this keeps the UI honest if it does not.
|
||||||
|
clear()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clearRecovery: () => set({ recovery: false }),
|
clearRecovery: () => set({ recovery: false }),
|
||||||
|
|||||||
@@ -58,7 +58,12 @@ header shows "Se connecter" or "Mon espace".
|
|||||||
`https://<project>.supabase.co/auth/v1/callback`; Apple needs a paid developer
|
`https://<project>.supabase.co/auth/v1/callback`; Apple needs a paid developer
|
||||||
account and a Services ID (BACKEND_ARCHITECTURE §2);
|
account and a Services ID (BACKEND_ARCHITECTURE §2);
|
||||||
- `[auth.mfa.totp]` enrolment and verification are on server-side;
|
- `[auth.mfa.totp]` enrolment and verification are on server-side;
|
||||||
- redirect URLs allow `http://127.0.0.1:5173/**` and `http://localhost:5173/**`.
|
- redirect URLs allow `http://127.0.0.1:5173/**` and `http://localhost:5173/**`
|
||||||
|
(local only). On the hosted project the allowlist is exact, never a host
|
||||||
|
wildcard: Site URL `https://<prod-origin>`, Redirect URLs
|
||||||
|
`https://<prod-origin>/auth/callback` and `https://<prod-origin>/reset-password`.
|
||||||
|
A broad pattern there turns `emailRedirectTo` / `redirectTo` into a
|
||||||
|
server-side open redirect.
|
||||||
|
|
||||||
The app side: `APP_AUTH_PROVIDERS=google,apple` (Docker) or
|
The app side: `APP_AUTH_PROVIDERS=google,apple` (Docker) or
|
||||||
`VITE_AUTH_PROVIDERS` (dev) lists the buttons to show. Showing a button for a
|
`VITE_AUTH_PROVIDERS` (dev) lists the buttons to show. Showing a button for a
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export type AuthFailureKind =
|
|||||||
| 'rate_limited'
|
| 'rate_limited'
|
||||||
| 'link_expired'
|
| 'link_expired'
|
||||||
| 'session_expired'
|
| 'session_expired'
|
||||||
|
| 'reauthentication_needed'
|
||||||
| 'provider_disabled'
|
| 'provider_disabled'
|
||||||
| 'network'
|
| 'network'
|
||||||
| 'unknown'
|
| 'unknown'
|
||||||
@@ -49,6 +50,8 @@ const CODE_TO_KIND: Record<string, AuthFailureKind> = {
|
|||||||
session_expired: 'session_expired',
|
session_expired: 'session_expired',
|
||||||
session_not_found: 'session_expired',
|
session_not_found: 'session_expired',
|
||||||
refresh_token_not_found: 'session_expired',
|
refresh_token_not_found: 'session_expired',
|
||||||
|
reauthentication_needed: 'reauthentication_needed',
|
||||||
|
reauthentication_not_valid: 'reauthentication_needed',
|
||||||
provider_disabled: 'provider_disabled',
|
provider_disabled: 'provider_disabled',
|
||||||
oauth_provider_not_supported: 'provider_disabled',
|
oauth_provider_not_supported: 'provider_disabled',
|
||||||
email_provider_disabled: 'provider_disabled',
|
email_provider_disabled: 'provider_disabled',
|
||||||
|
|||||||
Reference in new issue
Block a user