Security defaults
Registration
Section titled “Registration”A registration answers the same way whether or not the email is taken. When the account already exists, the owner of that address gets an “account exists” mail instead of the caller seeing an email in use error, so registration cannot be used to find out who has an account.
Email addresses
Section titled “Email addresses”By default addresses are trimmed and their ASCII letters lowercased; an address with any non-ASCII character is refused, which is stricter than NFC plus Unicode lowercasing (that folding can merge two different addresses into one account). Internationalised domains go in as punycode, and the domain must be a host name (letters, digits and inner hyphens per label, so no IPv4 address such as 127.0.0.1 and no exa_mple.com), under every built-in policy. An app adopting the package must find stored addresses with non-ASCII characters first, because their owners can no longer sign in or reset by them, or pick another policy with email.normalize: ascii (the same spelling, with its own email_not_ascii answer), unicode (NFC and lowercase, mixed-script, invisible and a few Latin lookalikes refused, with no full confusables check) or a function of its own. Whichever it is, one normaliser serves every flow, store write and counter key, and changing it on a live database needs a data migration first.
Lockout
Section titled “Lockout”- There is no permanent lockout by default, because a permanent lock lets an attacker lock a victim out. An app can opt into a permanent tier that only an admin clears (
throttle.lockout.permanent), accepting that trade-off. - Attempt budgets are keyed on account plus IP, and on the account as a whole.
- Backoff is exponential, capped at 1 hour, and resets only after a quiet day with no new lock.
- A correct password returns only the budget of the source that proved it, never the account-wide one, unless the app opts into
throttle.lockout.countSuccesses: false: then a completed sign-in, every factor proved, hands that slot back too. - A browser that completed a full login carries a signed device cookie. It is used only while the account is locked, where it lets a correct password through; correct logins never spend a device budget, and wrong guesses count against a failure budget shared by all of the account’s devices and against the account. The cookie is refused after 30 days and voided by a password change, a reset or signing out everywhere. A distributed attack cannot keep the owner out, and holding many cookies adds no guesses.
- The owner is mailed when the account locks; the mail is sent off the response path.
- A password reset lifts a temporary lock. A permanent one (opt-in) is lifted only by an admin.
- A locked account is answered exactly like a wrong password, after the same work: the same store calls and a full password verify. An app can opt into an explicit
account_lockedanswer (throttle.lockout.revealLocked), which tells anyone the address is locked.
Sessions
Section titled “Sessions”- Revoking another device, or every other device, needs fresh authentication by default, so a stolen session cannot sign the owner out (an app may turn that off per door with
session.requireFreshAuth). Every door that asks for it (revoking devices, enrolling a second factor, a step-up check) reads it from the live session in the store, not from the session object it was handed. - Plugins and
auth.contextsee sessions without a way to mint one; every session goes through one internal seam. - A login rehash is a compare-and-set, so it can never bring back a password changed meanwhile.
An Origin allowlist, a Sec-Fetch-Site check and a signed double-submit token bound to the session, or before sign-in to a random per-browser pre-session id, signed with its own secret of 32 bytes or more. See CSRF.
Breached passwords
Section titled “Breached passwords”The check is off until you pass password.breachCheck: pwnedPasswords() to createAuth. It uses the Have I Been Pwned k-anonymity range API and fails open, so an outage does not block sign-ups, password changes or resets, and each failure is counted and written to the audit trail as password.breach_check_unavailable.
Password hashing
Section titled “Password hashing”Argon2id with 19 MiB of memory, t=3, p=1: OWASP’s memory floor with the auth guide’s pass count. Parameters below OWASP’s table are refused. Hashes are rehashed on login when parameters change. See Passwords.
Sessions and scope
Section titled “Sessions and scope”- Redis is the only production session store the packages ship (
@noctcore/auth-redis); the in-memory store under@noctcore/auth/testingis for tests only. - There is no OAuth or OIDC sign-in yet (#30).
How to report
Section titled “How to report”Report vulnerabilities privately, following SECURITY.md.
Where these come from
Section titled “Where these come from”The defaults come from an implementation that already runs in production, checked against Pilcrow’s auth guide; where they disagreed, the stricter one was kept. Design choices lists each case.