docs(docs): V1-2.5 administration, MFA, catalogue documented
CLAUDE.md overview and folder map, IDENTITY §1 and §4, BROWSER_TESTS shell specs, V1-2 contract §16.6 state and §5.7.3-§5.7.4 pointers, design README owning steps with two deviations.
This commit is contained in:
1 parent
c12702bac1
commit
3d2b5a5f1c
5 files changed
+97
-32
No files matched your search
@@ -18,13 +18,23 @@ by side until the plan's Step 14 decides what goes behind authentication.
|
||||
| `/reset-password` | none; needs the recovery session | new password ×2; "invalid or expired link" otherwise |
|
||||
| `/auth/callback` | none | landing of OAuth redirects and confirmation links; waits for the session then goes to `/app` (or `?next=`) |
|
||||
| `/app` | `RequireAuth` | dashboard: greeting, profile completeness card, local tool card, account card |
|
||||
| `/app/account` | `RequireAuth` | Mon compte: profile photo (Step 8, `STORAGE.md` §4), personal, professional, preferences (language, timezone), security (password, MFA note, sign out) |
|
||||
| `/app/account` | `RequireAuth` | Mon compte: profile photo (Step 8, `STORAGE.md` §4), personal, professional, preferences (language, timezone), security (password, TOTP factors since V1-2.5 (§4), sign out) |
|
||||
| `/app/anatomy`, `/:sheetId`, `/:sheetId/versions/:number` | `RequireAuth`, `RequireCatalog` (V1-2.5) | catalogue of official sheets, a sheet's current version, an earlier version; « Accès non autorisé » on the server's refusal, the same for an unknown sheet |
|
||||
| `/app/admin`, `/sheets`, `/sheets/new`, `/sheets/:sheetId`, `/species`, `/access` | `RequireAuth`, `RequireAdmin` (V1-2.5, step-up to `aal2`) | administration home, official sheets, species, rights (owner); each page shows what the caller's capabilities allow |
|
||||
|
||||
`RequireAuth` waits for the client to read the persisted session, then sends
|
||||
a visitor to `/login?next=<path>`; `next` is honoured only when it is a
|
||||
same-origin path (`safeNextPath`). `/app/*` under the guard renders inside
|
||||
`AppLayout` (desktop sidebar, light top bar, mobile drawer).
|
||||
|
||||
`RequireCatalog` decides nothing: the pages ask the server and show
|
||||
« Accès non autorisé » (`AccessDenied`) when it refuses. `RequireAdmin`
|
||||
renders the admin pages only on an `aal2` session, so no admin data is
|
||||
requested before the step-up (§4). The « Fiches anatomiques » and
|
||||
« Administration » entries of the sidebar and drawer follow a hint built from
|
||||
the caller's own grant rows and roles (`auth/navigationHint.ts`): a hidden
|
||||
entry protects nothing, every RPC checks the capability and `aal2` itself.
|
||||
|
||||
A deployment without Supabase (`APP_SUPABASE_URL` empty) shows an
|
||||
"unavailable" notice on the auth screens; `/app` redirects to `/login`; the
|
||||
Home header shows no entry to the space. With Supabase configured, the Home
|
||||
@@ -44,7 +54,8 @@ header shows "Se connecter" or "Mon espace".
|
||||
(`display_name, first_name, last_name, phone, locale, timezone,
|
||||
practice_name, professional_title, siret`). `active`,
|
||||
`phone_verified_at` and roles are server-only.
|
||||
- Platform roles are read-only badges (`shell.role.*`); no admin screen yet.
|
||||
- Platform roles are read-only badges (`shell.role.*`). The administration
|
||||
space (V1-2.5) manages catalogue rights and species, never platform roles.
|
||||
- GoTrue errors never reach the screen: `classifyAuthError` folds codes into a
|
||||
closed `AuthFailureKind`, phrased by `auth.failure.*`.
|
||||
|
||||
@@ -79,25 +90,38 @@ that made the request (the code verifier lives in its localStorage). Opened
|
||||
elsewhere, the email is still confirmed server-side but no session opens; the
|
||||
callback page says so and the user signs in normally.
|
||||
|
||||
## 4. MFA: what the foundations have, what is missing
|
||||
## 4. MFA (TOTP)
|
||||
|
||||
Architecture §2 wants TOTP mandatory for `owner/admin/moderator/support`,
|
||||
enforced by an RLS helper `has_mfa()` on admin tables. Today:
|
||||
Architecture §2 wants TOTP mandatory for platform roles; V1-2 decision
|
||||
BDR-083 requires `aal2` for every platform role change and every catalogue
|
||||
right (`V1-2_ANATOMICAL_SHEETS.md` §5.6, §5.7). State since V1-2.5:
|
||||
|
||||
- server: TOTP enrolment/verification enabled (this step); nothing enforces it;
|
||||
- SQL: no `private.has_mfa()` helper (would read `auth.jwt() ->> 'aal' = 'aal2'`);
|
||||
the role helpers `private.is_platform_*` ignore the assurance level;
|
||||
- app: no enrolment UI (QR + code), no `aal2` step-up on sign-in;
|
||||
- there is no admin table or screen yet to protect.
|
||||
- server: TOTP enrolment and verification on (`[auth.mfa.totp]`). Since M4
|
||||
(`20261028100000_sheet_access_hardening.sql`) `private.has_mfa()` reads the
|
||||
token's `aal` claim, and `private.has_aal2_session()` also requires the
|
||||
token's session to still be `aal2` in `auth.sessions`; the role and rights
|
||||
RPCs use the second, the catalogue policies and RPCs the first. The
|
||||
`is_platform_*` helpers still ignore the level: the RPCs that need it call
|
||||
the helpers above.
|
||||
- Mon compte, Sécurité (`components/account/{MfaFactors,EnrolTotp}.tsx`):
|
||||
the factor list (verified and unverified), adding a factor (name, QR code,
|
||||
secret for manual entry shown once and kept in the component's state only,
|
||||
then a code), removal after a confirmation. An unverified factor the
|
||||
enrolment made is removed on cancel or unmount (a dormant factor is a path,
|
||||
V1-2 contract §5.7.3). `packages/supabase/src/mfa.ts` folds GoTrue's answers into the
|
||||
closed `MfaFailure` kinds (`mfa.failure.*`).
|
||||
- Step-up at `/app/admin` (`RequireAdmin`): an `aal1` session is asked for a
|
||||
code from one of its verified factors; without one, it is sent to Sécurité.
|
||||
- Step-up inside an action (`auth/useStepUp.ts`, `components/auth/InlineStepUp`):
|
||||
when GoTrue refuses below `aal2` (`aal2_required`: a second factor, the
|
||||
removal of a verified one, a password change), the challenge opens in place
|
||||
and the action is sent to GoTrue again once it succeeds, never bypassed.
|
||||
- Password reset (`/reset-password`): an account with a verified factor
|
||||
steps up before the new password is sent, the recovery session included
|
||||
(§4.1).
|
||||
|
||||
V1-2 decision (BDR-083): `aal2` is required for every platform role change,
|
||||
see `V1-2_ANATOMICAL_SHEETS.md` §5.7 (rule, bootstrap, recovery).
|
||||
|
||||
The Security section shows a note instead. To close the gap (a later step):
|
||||
migration adding `private.has_mfa()` and folding it into `is_platform_*` (or
|
||||
into the policies of the first admin table) with pgTAP allowed/denied cases;
|
||||
enrolment + challenge screens in Mon compte; step-up at sign-in for accounts
|
||||
holding a platform role.
|
||||
Still open: the recovery runbook for a lost factor (V1-2 contract §5.7.7) is
|
||||
rehearsed at V1-2.9.
|
||||
|
||||
### 4.1 GoTrue v2.197.0 behaviour, measured on the sandbox (V1-2.5)
|
||||
|
||||
|
||||
Reference in new issue
Block a user