Security
The protections of Beffroi OP are built into the code rather than exposed as settings. There is no global switch that turns one off; the few exceptions are scoped to one client or one tenant.
Secure defaults
Common weaknesses of identity providers, and how Beffroi handles each one. None of these behaviours can be configured away.
- No implicit flow
- Tokens are never returned in a redirect. A token only ever comes from the token endpoint.
- No password grant
- An application never sees a password.
- PKCE required
S256only. A confidential client that cannot send a challenge is exempted one at a time, never a public one.- Exact redirect URI matching
- Compared byte for byte, trailing slash included, with no prefix or wildcard. Only the port of a public client's loopback address is free.
- Issuer identification
- The issuer is included in every authorization response, so that a client can tell which provider answered.
- Typed access tokens
- An access token is a JWT of the registered type, or an opaque reference. A resource server knows what it validates.
- No redirects to an address a client chose
- When the provider fetches the keys, a request object or the metadata of a client, redirects are not followed. A fetch never becomes a request to an address the client chose. The only redirects followed are those of the optional MaxMind download and of a revocation list of the FIDO Alliance, each to the one host the application names.
- Password policy
- Fifteen characters where a password signs in alone, twelve where a second factor goes with it. A value found in a list of compromised passwords is refused, when the deployment configures such a list.
- Automatic key rotation
- A key signs for a set period, then a successor is staged behind it without any action required. A compromised key is removed from the JWK Set immediately.
- SAML algorithm restrictions
- SHA-1, MD5, HMAC, DSA and ECDSA are refused, nothing is encrypted in CBC, a peer's keys come from its metadata and never from the message, and an unsolicited response is refused.
- No global insecure mode
- An exception is named, bounded and recorded where it applies: a client, a service provider or a tenant. A way to bypass a protection without a change of configuration is a vulnerability.
Every response of the application carries nosniff, X-Frame-Options: DENY, Referrer-Policy: no-referrer, HSTS for a year, and a content security policy that starts at default-src 'none' with neither unsafe-inline nor unsafe-eval. CORS is open on the six endpoints a client running in a page calls, never with credentials.
Sign-in protection
The provider stores nothing that can be replayed as a credential: passwords are hashed, a passkey's private key never leaves the authenticator, and the secret of a one-time code generator is sealed by the key management service.
- Rate limiting
- Five passwords and five codes per user in a sliding minute, counted per user and never per address.
- Account enumeration
- An unknown username, too many attempts or a user without a password still pays the verification of a hash, and the page shows one message whatever the reason.
- Password hashing
argon2idat the parameters the standard recommends. An older hash is replaced at the next successful sign-in.- One-time codes
- A code is accepted once, and an earlier one is refused after a later one was accepted.
- Credential changes
- Adding or removing a credential requires an authentication from the last five minutes, whatever the age of the session.
- Federated users
- A user of a domain handled by an upstream identity provider signs in there and nowhere else: no local password is set for them, nor accepted from them.
Encryption at rest
Signing keys are sealed by the key management service and personal data is encrypted in its column. A copy of the database alone exposes neither.
Without the key management service and the secret of the deployment, the following stays sealed: usernames, email addresses, profiles, phone numbers and postal addresses; where each session was opened from; what a client was given about a user; the secret of an authenticator application. Passwords and backup codes are hashes, readable by nobody. The body of every message on a transport is sealed too, so that a queue, a failure table and a backup of either hold nothing readable.
Outbound connections
With the shipped configuration, the provider makes no outbound call on its own. Every connection targets an address set by the deployment, registered by a client or triggered by an operator.
An instance can run with no route to the internet: clients carry their keys inline, SAML peers are declared from a file, and the optional lists are left unconfigured. To verify it, run the instance in a network that only allows egress to the database and the key management service, exercise it, and review what was blocked. Outside those two downloads, every outbound call is made with redirects disabled.