This is the written statement ASVS 6.1.3 and 6.3.4 ask for: every authentication pathway the shop mounts, the controls each one carries, and the controls it deliberately does not. A reviewer should be able to tell a decision from an omission without reading the source.
Vocabulary follows GLOSSARY.md: Inscription, Vérification de l'e-mail,
Réinitialisation du mot de passe, Connexion, Test de sécurité,
Session courante, Session inactive, Session hors durée absolue,
Compte client, Commande, Panier.
Every pathway carries a status. Held means the shop mounts the pathway and enforces the controls below. Mounted without a surface means the library serves it and the shop presents nothing. The status is the statement; a reader needs no history of the work to read today's state (ADR-0058). A control the shop deliberately does not carry is recorded under that pathway's Deliberately absent heading.
| Pathway | Status | Surface | Mounted by |
|---|---|---|---|
| Inscription | Held | POST /api/auth/sign-up/email |
better-auth |
| Vérification de l'e-mail | Held | POST /api/auth/email-otp/send-verification-otp, POST /api/auth/email-otp/verify-email |
emailOTP plugin |
| Connexion par mot de passe | Held | POST /api/auth/sign-in/email |
better-auth |
| Connexion par code | Mounted without a surface | POST /api/auth/sign-in/email-otp |
emailOTP plugin, no UI |
| Connexion sociale | Held | GET /api/auth/callback/{google,facebook} |
better-auth |
| Réinitialisation du mot de passe | Held | POST /api/auth/email-otp/send-verification-otp (type forget-password), POST /api/auth/email-otp/reset-password |
emailOTP plugin, page /mot-de-passe-oublie |
| Suppression des données Facebook | Held | POST /api/facebook/suppression-donnees, page /suppression-donnees |
app/api/facebook/suppression-donnees/route.ts |
Every route is served by app/api/auth/[...all]/route.ts except the Meta
callback. That wrapper purges an over-age session before the handler runs, and
replays the Visiteur's Panier after a successful Connexion, on any of the four
entry points lib/points-entree-connexion.ts names (ADR-0007, ADR-0024). It does
not wrap the Meta route.
Enforces
- 15-character minimum, shared by the server config and the client schema
(
lib/longueur-mot-de-passe.ts); the library's 128-character maximum remains. - The password is checked against Have I Been Pwned before the account exists
(k-anonymity, fail-closed: an upstream failure refuses the Inscription). The
same check covers both reset routes, not
/change-password(ADR-0043). - The Test de sécurité, when
TURNSTILE_SECRET_KEYis configured, on/sign-up/email. - No account enumeration: with
requireEmailVerification, an existing address receives the same synthetic response as a new one. - No session is created at the Inscription:
requireEmailVerificationdisables auto sign-in; the Compte client exists but cannot sign in until the Vérification de l'e-mail, which opens the Session (ADR-0061). - A unique e-mail (
user.email) and a unique(providerId, accountId)pair in the database.
Deliberately absent
- No password composition rule, no strength meter, no username. Length and the breach check are what NIST and ASVS ask for.
- No local top-N blocklist beyond Have I Been Pwned.
- No MFA, passkey or two-factor enrolment.
Enforces
- Six-digit one-time code, stored hashed (SHA-256, base64url) with its attempt count; the code is never returned by the API (ADR-0043).
- 5-minute lifetime, three attempts, then the code is destroyed.
- The Test de sécurité on the send endpoint, when configured; 60 s / 3 requests
per address and path (the
emailOTPplugin's rule). - The request is enumeration-safe: an unknown address receives the same success response and no e-mail.
- Verifying promotes
emailVerifiedand opens the Session (autoSignInAfterVerification, ADR-0061): the client leaves the code step signed in, with the password chosen at Inscription kept for the next Connexion par mot de passe.
Deliberately absent
- No magic-link verification is used;
/verify-emailis mounted by the library but nosendVerificationEmailsender is configured, so no link is sent — the code is the only proof of the address. - No per-account throttle beyond the three-attempt cap on the code itself.
- No e-mail change in this pathway.
Enforces
- Uniform
INVALID_EMAIL_OR_PASSWORDfor unknown address, missing credential, missing password and wrong password; the library still runs a dummy hash so timing does not reveal existence. EMAIL_NOT_VERIFIEDis distinguishable only after the password checks out.- Per-address and per-path limiter: 10 s / 3 attempts on
/sign-in/*; the client address is resolved fromcf-connecting-ip,x-real-ip, then the first untrustedx-forwarded-forhop read from the right, past the declared trusted proxies (ADR-0042). - Per-account counter in Redis, keyed by the normalized typed address: 10
consecutive failures open a 15-minute
ACCOUNT_TEMPORARILY_LOCKEDrefusal, before the password check; a successful Connexion clears it; the TTL eases by itself. The per-address limiter stays the first line (ADR-0047). - The 15-character floor applies to new passwords; an existing shorter password still authenticates.
- The Test de sécurité, when configured, on
/sign-in/email. - A session with 30 minutes of inactivity (Session inactive), a 6-minute
sliding refresh, and an absolute bound of 30 days for a Client and 24 hours
for the Administration (Session hors durée absolue,
SESSION_ABSOLUTE_*). The bound deletes the session row at the first read of the Session courante or the first/api/auth/*request carrying its cookie (ADR-0024). - Cookies are
HttpOnly,SameSite=Lax,Path=/, and__Secure-on HTTPS; there is no cookie cache, so a revocation is immediate. - The Visiteur's Panier is replayed onto the Compte client after a successful Connexion.
- A Réinitialisation du mot de passe that commits while this sign-in is verifying the old password deletes the session the sign-in just created, so the reset ejects a Connexion already in flight. The credential version seen at the start of the request is compared with the one read after success.
- The browser keeps the Moyen de connexion of the last successful Connexion
in a first-party, host-only, non-HttpOnly cookie for 30 days, under the shop's
own name
eguidar.dernier-moyen-de-connexionand vocabulary (mot-de-passe,google,facebook). The Connexion modal names it in one muted hint line above the methods, in the form step only, when the method is offered and at least two methods exist. No server route reads it; it never selects, hides or reorders a method and replaces no credential (ADR-0063).
Deliberately absent
- No MFA, passkey or security key; the password remains a single factor, which is why the floor is 15 (NIST SP 800-63B-4 §3.1.1.2) and not 8.
- No composition rules, no account-lockout escalation beyond the 15-minute window, and no extra Test de sécurité after the threshold (the endpoint already carries one when configured).
- No password change in the Connexion modal; the reset page is the only self-service credential change.
- No OAuth token is involved here; provider tokens are out of scope.
This endpoint is mounted by the emailOTP plugin and has no surface in the
shop's UI.
Enforces
- Six-digit code sent with
type: "sign-in"; same hashed-at-rest storage, 5-minute lifetime and three-attempt cap as Vérification de l'e-mail. - 60 s / 3 requests per address and path (the plugin's rule for
/sign-in/email-otp). - For an existing Compte client whose e-mail was never verified,
revokeUnprovenAccountAccessdeletes every linked account (password and Google/Facebook), revokes all its sessions, and promotesemailVerifiedbefore signing in — the library-owned control ADR-0041 relies on. - A session is created with the same inactivity and absolute bounds as the password Connexion.
- The Visiteur's Panier is replayed:
/sign-in/email-otpis one of the four entry pointslib/points-entree-connexion.tsnames.
Deliberately absent
- No UI and no link from the Connexion modal. It is a mounted pathway, not a product surface.
- The Test de sécurité covers the code send (
/email-otp/send-verification-otp) but not/sign-in/email-otpitself: the Test de sécurité plugin's endpoints do not include that route. disableSignUpis left at its default (false): the endpoint can create a Compte client with a verified e-mail for any address whose mailbox is read. This is deliberate and bounded by the mailbox, not by the shop.
Providers: Google and Facebook.
Enforces
- The provider's authorization code exchange, state check and callback are owned by Better Auth; the shop does not implement OAuth itself.
- Facebook's profile e-mail counts as verified (
mapProfileToUsersetsemailVerified: true), because Facebook requires a confirmed address before Connexion; Google already reports one (ADR-0019). - Linking follows the library's default gates: no
trustedProviders, norequireLocalEmailVerified: false. A social identity links to an existing Compte client when the provider reports a verified e-mail (both providers do) and the local Compte client is verified; otherwise the callback refuses withaccount not linked. (providerId, accountId)is unique in the database, so one Google or Facebook identity can never map to two Compte clients.- The visitor's Panier is replayed after a successful callback.
- The resulting session carries the same inactivity and absolute bounds, and the auth wrapper purges an over-age session before the callback.
- Provider access and refresh tokens are encrypted at rest
(
account.encryptOAuthTokens); the key derives fromBETTER_AUTH_SECRET, so rotating the secret makes existing tokens unreadable — accepted, because nothing in the shop reads them (ADR-0060). - A failed Connexion sociale returns the Client to the page they were on, with the Connexion modal open and a translated message (ADR-0019 amendment, #853).
Deliberately absent
- No Test de sécurité: the flow is a top-level redirect, not a posted credential.
- No per-account failure counter on the OAuth path; the provider owns that credential.
Page /mot-de-passe-oublie; the flow is the e-mail code exchange, not a link
(ADR-0002).
Enforces
- Request is enumeration-safe: an unknown address gets the same success response and no e-mail.
- The Test de sécurité on the send endpoint, when configured; 60 s / 3 requests per address and path.
- The code is hashed at rest, expires after 5 minutes and is destroyed after three attempts (ADR-0043).
- The new password must be 15 characters and is checked against Have I Been Pwned before the credential is written.
revokeSessionsOnPasswordResetis enabled: inside the reset transaction, the Compte client's sessions are deleted before the new password is written, so the old password's holder is ejected and the Client signs in again (ADR-0002 amendment, #834).- The exchange re-creates the
credentialaccount if it disappeared and promotesemailVerified.
Deliberately absent
- No reset link/token URL; the six-digit code is the only reset secret.
- No security questions, no reset by the Administration from this surface; no admin password routes exist: no admin plugin is mounted.
- No Have I Been Pwned coverage for
/change-password(ADR-0043's declared scope).
Public route for Facebook's data-deletion callback (ADR-0046). It is not behind the Connexion modal and reads no session.
Enforces
signed_requestmust be exactly two non-empty base64url segments; the first isHMAC-SHA256of the second, keyed withFACEBOOK_CLIENT_SECRET, compared in constant time after a length guard. The payload must carry a non-emptyuser_idandalgorithm: "HMAC-SHA256".- A valid request deletes, in one transaction, the Compte client, its Commandes
(and their OrderItems by cascade), its sessions, accounts, Articles du panier
and Brouillons d'Image produit, plus the
verificationrows Better Auth writes for one of its addresses: the<type>-otp-<address>codes, and thechange-email-otp-…rows the pattern matches. The cached Commande pages are invalidated after the commit. - The response carries exactly
{ url, confirmation_code }; the status page at/suppression-donnees?code=…is public and confirms the deletion. - An unknown ASID is a
200with code and deletes nothing (idempotent replay). A wrong or malformed signature is403; a missing secret or a failed transaction is a generic500; every response isno-store.
Deliberately absent
- No session, cookie, Turnstile or CSRF token: Meta calls server-to-server, and the HMAC is the authentication.
- No rate limiter or per-ASID throttle beyond the HMAC.
- No retention or anonymisation of Commandes; the Client asked for deletion.
- The Meta dashboard registration of
https://<domain>/api/facebook/suppression-donneesremains the one manual step.
These endpoints exist under /api/auth/* because Better Auth mounts them, but
they are not product surfaces and the shop configures no sender for them:
GET /verify-email— the token-link variant of Vérification de l'e-mail. NoemailVerification.sendVerificationEmailis configured, so no link is sent; the code exchange is the only used path.POST /request-password-resetandPOST /reset-password— the token-link reset. NosendResetPasswordis configured, so no mail is sent; the page/mot-de-passe-oublieand the code exchange are the supported reset./reset-passwordappears in the Have I Been Pwned plugin's paths because the plugin declares it, not because a surface uses it.POST /change-password— requires an authenticated session and is rate limited (10 s / 3). It is not linked from any surface, and the Have I Been Pwned check does not cover it (ADR-0043).
| Control | Value | Owner |
|---|---|---|
| Password floor | 15 characters | lib/longueur-mot-de-passe.ts |
| Password ceiling | 128 characters (library default) | better-auth |
| Password hash | $scrypt$N=131072,r=8,p=1$<salt base64url>$<key base64url>, legacy salt:hex accepted |
lib/mot-de-passe-hache.ts (ADR-0045) |
| Rehash | on successful Connexion when legacy or below target | lib/rehachage-mot-de-passe.ts |
| Session inactivity | 30 minutes, refresh every 6 | lib/session-constants.ts |
| Session absolute | 30 days Client, 24 hours Administration | lib/session-constants.ts, lib/session-expiration.ts |
| Per-address auth limiter | 10 s / 3 for sign-in and sign-up; 60 s / 3 for code sends | better-auth (memory, per process) |
| Per-account failed-Connexion counter (normalized typed address) | 10 failures / 15 minutes, Redis | lib/echecs-connexion.ts (ADR-0047) |
| Provider identity | unique (providerId, accountId) |
prisma/schema.prisma, migration 20261101160000 |
| Breach check | Have I Been Pwned, fail-closed, three declared paths | lib/auth.ts (ADR-0043) |
| Test de sécurité | Turnstile on sign-up, password sign-in and verification/reset sends | lib/auth.ts |
| Verification identifier | Not unique: a send inserts a row, a read keeps the newest by createdAt, a consume deletes every row for the identifier |
prisma/schema.prisma (ADR-0058) |
| Trusted origins | The shop's own origins plus the preview origin the deployment declares | lib/origines-de-confiance.ts |
| Provider tokens | Encrypted at rest, key derived from BETTER_AUTH_SECRET |
lib/auth.ts (ADR-0060) |
| Test de sécurité scope | Exact action and hostname allow-list | lib/test-de-securite.ts |
| Panier replay | Four entry points | lib/points-entree-connexion.ts (ADR-0007) |
| Last login method hint | eguidar.dernier-moyen-de-connexion, 30 days, non-HttpOnly, hint only |
lib/moyen-de-connexion.ts (ADR-0063) |
- MFA, passkeys/WebAuthn, TOTP, recovery codes. The password is a single factor today; that is why the floor is 15 (ADR-0060).
- Password composition rules and a strength meter (NIST/ASVS ask for length, blocklists, and no forced rotation).
- A local breached-password list beyond Have I Been Pwned.
- A per-account throttle on the code pathways beyond the per-code attempt cap.
- Administrative MFA or a second factor on the Administration.
The scrypt parameters are the OWASP strongest tier. The benchmark ran on the
Coolify host (linux arm64, Node v22.23.4, 4 vCPU) on 2026-11-02: about
331 ms per hash (min 328, max 333), under the one-second rule, against about
385 ms on the development host. The next OWASP tier (N=2^16, r=8, p=2, then
N=2^15, r=8, p=3) remains a one-constant change, and the rehash-on-Connexion
migrates existing Comptes clients without a reset.