php-sso php-sso

Security

What php-sso does to protect people and data, page by page.

This section describes what the server does by itself, and what it expects of you. Where something is a setting, the page says which.

PageWhat it covers
Security headersThe headers every response carries, the default Content-Security-Policy, and how to change it for a theme
Sessions and cookiesThe browser session cookie, where its files live, and how long a session lasts
Signing keysHow tokens are signed, rotating the key, and what to back up
Audit logWho changed what and when, what is recorded, how long it is kept, and sending it elsewhere
Safe startupWhat the server refuses to start with, and why: plain HTTP, demo data, a weak first password

Related, described where they belong:

What is stored, and how #

  • Passwords are stored as a salted hash made with PHP’s password_hash, never as text. Client secrets are stored the same way.
  • Authorization codes, refresh tokens and SCIM tokens are stored as hashes. A copy of the database does not give anyone a token, and a SCIM token is shown once, when it is made.
  • Authenticator secrets (two-step verification) are encrypted with AES-256-GCM before they go into the database. The key is the file var/keys/mfa.key: back it up with the rest of var/keys, because without it every saved authenticator stops working.
  • Signing keys for tokens are in var/keys too. Whoever has them can make tokens that every app will believe, so keep that folder readable only by the server. Rotate them with bin/keys.

What is not there yet #

  • The audit log is in the same database as the data it describes, so it is not proof against someone who can change the database: stream it elsewhere for that. See also Not production ready.
  • php-sso has not had an independent security review. The code and the tests are public, and the Basic OP plan of the OpenID Connect conformance suite can be run against it (conformance/README.md says what has been run), but neither is an independent review.

Reporting a problem #

Please report a vulnerability privately, through GitHub’s “Report a vulnerability” button on the repository’s Security tab. The policy, with what to expect and when, is in SECURITY.md.