auth: security audit fixes, rate limits on every route
Two separate reviews of the SSO branch and all 207 API routes (spec 12 §8.6). Every route was guarded as meant. Fixed, each with a test: - login: a directory 503 counts as a failed sign-in; a locked directory account is a refused password, not "unavailable" - open redirect after OpenID sign-in (a tab in next) - directory email matching only for non-admins without their own password; others connect on My settings (POST /api/me/identities/ldap); only admins disconnect a directory account - OpenID session check reads the refreshed ID token's claims too - connect is POST /api/auth/oidc/connect (CSRF header) - stored bind password, client secret and SMTP password tied to their server - 409 role_managed when a provider sets the role; empty Contrack PATCH is a 400 - @fastify/rate-limit on every route (RATE_LIMIT_PER_MINUTE), 10/min on Test buttons; a password asked again shares the login limiter Live tests pass against lldap 0.6.3, Samba 4 AD and Keycloak 26.8.1.
This commit is contained in:
1 parent
19610777a4
commit
97e67e347d
39 files changed
+1059
-186
No files matched your search
@@ -118,9 +118,22 @@ Keycloak (26.8.1) is the one SelfPhoneNG is tested against.
|
||||
## Directory (LDAP)
|
||||
|
||||
With a directory, people sign in with their **directory username or email and password**. When
|
||||
the password isn't the one set in SelfPhoneNG, SelfPhoneNG asks the directory. The first time,
|
||||
they're matched to their user here by the directory's email; nobody gets a user just for being in
|
||||
the directory. Their SelfPhoneNG password, if they have one, keeps working too.
|
||||
the password isn't the one set in SelfPhoneNG, SelfPhoneNG asks the directory. Nobody gets a user
|
||||
just for being in the directory, and their SelfPhoneNG password, if they have one, keeps working
|
||||
too.
|
||||
|
||||
The first time, the directory account is connected to their user here:
|
||||
|
||||
- **New users** (still on the temporary password from Users, or with none): automatically, by the
|
||||
directory's email.
|
||||
- **Everyone else, and every admin**: they sign in with their SelfPhoneNG password once, then
|
||||
**My settings** (admins: **My account**) → **Sign-in** → **Connect directory account** with their
|
||||
directory username and password. An email alone never connects an admin or someone who chose
|
||||
their own password, so a directory that lets people edit their own email can't hand out an
|
||||
account.
|
||||
|
||||
Only an admin can disconnect a directory account (Users → the user → Sign-in): it's what the
|
||||
hourly leaver check follows.
|
||||
|
||||
**Settings → Sign-in → Directory (LDAP)**:
|
||||
|
||||
|
||||
Reference in new issue
Block a user