Security checklist
@dotpress/auth is secure by default: rotating refresh tokens, short-lived access tokens, throttled logins, httpOnly cookies protected against CSRF. Some decisions remain yours. Check this list before going to production.
Keys and tokens
- The private key is stored in a secret manager, never in the repository or an image. Keys
- Each environment has its own key pair, and its own
issuer. Keys - The keys are rotated on a schedule, and you know how to rotate them after a leak. Rotation
-
accessTokenTTLstays short: 15 minutes by default. Access tokens - The username is not written in the tokens, unless needed (
usernameClaim). Access tokens
Browsers
- Browser applications use the cookie mode with
accessTokenInCookie: no token is readable by the JavaScript of the page. Cookie mode - The API is served over HTTPS only, and the cookies stay
secure. Cookies - CORS lists the trusted origins explicitly, without
'*'or a function accepting any origin. CORS - No
GETroute changes data: they are not checked against cross-site requests. CSRF - Mobile applications keep their tokens in the secure storage of the platform (Keychain, Keystore), never in plain files.
Sessions
- Every session is revoked when a password is changed or reset, and when an account is disabled. Password change
-
findUserById()returnsundefinedfor deleted, disabled and banned accounts. Data provider - Privileged applications (backoffice) have an absolute session timeout. Session lifetimes
- Sensitive applications reject the tokens of a revoked session at once, with
isSessionRevoked. Revocation -
onRefreshTokenReuseraises an alert: a reused refresh token means a stolen session. Rotation
Passwords and logins
- Passwords are long (12 characters or more), without composition rules, and checked against known leaks. Rules
- The schemas of sign-up and password change reject passwords over 72 bytes (
isPasswordTooLong). 72-byte limit - The bcrypt cost (
passwordHashRounds) is measured on your servers, and matches your stored hashes. Hashing - With several instances, the login throttle uses a shared store. Shared store
- Behind a proxy, the server trusts the proxy headers, so that each client has its own IP address. Proxy
- Sign-up and password reset answer the same way whether the account exists or not. Enumeration
Authorization
- Every route reading or changing a resource checks that the user may access this resource, not only that a user is logged in. Authorization
- Response schemas list the returned fields: password hashes and internal fields never reach the client. Validation
- The routes of a backoffice require its client and a role (
requireClient(),requireRole()). Clients
The app
-
exposeErrorsis disabled in production. Errors - Unexpected errors are reported (
onError), and login failures are logged (onLoginFailed). Login events - Dependencies are kept up to date, and the security advisories of Dotpress are followed: see the security policy.