Lapis Docs

Running a site

Security

Lapis is secure by default: you do not have to switch anything on. This page lists what it does for you. Before going live, also read the security checklist of the deployment guide, which covers the web server.

Signing in

  • Passwords are hashed with Argon2id (where PHP provides it) and rehashed on sign-in when settings change. Every sign-in check runs inside a 300 ms timelock, whether the account exists or not, to prevent timing probes.
  • A new session id is issued on sign-in and on sign-out, against session fixation.
  • Disabling an account or changing its password invalidates existing sessions on the very next request.
  • Failed sign-ins are limited in the database. Within 15 minutes, 5 failed attempts are allowed per IP address and e-mail pair, and 20 per IP address. While a limit holds, even the right password does not sign in.

The editor API

Every write of the editor API needs an X-Lapis-Token header, and it must come from the same origin, which the browser's Sec-Fetch-Site header proves. Page functions get the same cross-site protection, see Page functions.

Content and uploads

  • Rich text blocks and data columns are cleaned on the server with Symfony's HTML sanitizer using an allow-list.
  • Uploaded SVGs are cleaned with an allow-list of drawing elements (no scripts, event handlers or external references). ./lapis media:clean-svg runs the current sanitizer on existing files.
  • Processed images have all metadata (such as EXIF and GPS coordinates) stripped.
  • Links, settings and page meta URLs are checked so schemes such as javascript: are refused.
  • Preview links and form time-trap tokens are signed with SIGNING_KEY.
  • Downloaded import map packages are verified against the integrity hashes recorded in importmap.php.

Headers

  • X-Content-Type-Options and Referrer-Policy go out on every answer.
  • /_lapis/* gets a strict Content-Security-Policy and X-Frame-Options: DENY.
  • Pages rendered for editors never go into a shared cache.

The Content-Security-Policy of the visitors' pages is the site's own choice. Set it with the Headers middleware.

Reviews

The holes found in security reviews are covered by tests in tests/Feature/SecurityTest.php.