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.

No global switch · Keys and data sealed by a KMS

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
S256 only. 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.
A stolen authorization code is refusedAn attacker who reads a code in a log, a referrer or a browser history presents it to the token endpoint. Beffroi refuses it: no PKCE verifier matches the challenge the application sent, and a code is accepted once.Token request, with the stolen codeRefused: no verifier matches the PKCE challengeReads a code in a log,a referrer or a historyBound to the application that asked for it, and accepted onceAttackerBeffroiAttackerBeffroi
A stolen authorization code is refusedAn attacker who reads a code in a log, a referrer or a browser history presents it to the token endpoint. Beffroi refuses it: no PKCE verifier matches the challenge the application sent, and a code is accepted once.Token request, withthe stolen codeRefused: no verifiermatches the PKCEchallengeReads a code ina log,a referrer or ahistoryBound to the applicationthat asked for it, andaccepted onceAttackerBeffroiAttackerBeffroi
Fig. 01 A code read in a log, a referrer or a browser history is presented to the token endpoint. It is refused: no verifier matches the PKCE challenge the application sent, and a code is accepted once.

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
argon2id at 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.

Outbound connectionsInside your network, the server and the worker reach PostgreSQL and the key management service. Beyond it, they call only the addresses your configuration and your clients declare, the push services of the browsers that subscribed, and optional lists you have to name first. Nothing is addressed to the project.Addresses from your configurationInside your networkneverThe serverand its workerPostgreSQLKey managementserviceA client's keys,request objects andsector identifierwhere it keeps themBack-channel logoutand notificationsat a client's addressSAML metadatawhere you declaredit, or from a fileWeb pushon until you emptyits subjectOptional listscompromisedpasswords,GeoLite2, FIDO:off until namedThe projectno telemetry,no version check
Outbound connectionsInside your network, the server and the worker reach PostgreSQL and the key management service. Beyond it, they call only the addresses your configuration and your clients declare, the push services of the browsers that subscribed, and optional lists you have to name first. Nothing is addressed to the project.Addresses fromyour configurationAddresses fromyour configurationInside your networkInside your networkneverThe serverand its workerPostgreSQLKey managementserviceA client's keys,request objectsand sectoridentifierBack-channellogout andnotificationsSAML metadataWeb pushon by defaultOptional listsoff until namedThe projectno telemetry
Fig. 02 Inside your network: PostgreSQL and the key management service. Beyond it: the addresses your clients registered and you declared, the push services of the browsers that subscribed to notifications, and optional lists that stay off until you configure a licence key or an endpoint. Nothing is addressed to the project.

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.

Get started with Beffroi OP.

Features Specifications