Security
Security model, single sign-on, key protection and checklist.
This page summarises what you should know about the security model as an operator. The full concept with sources and audits is in SECURITY.md (German).
Data encryption
| Data | Protection |
|---|---|
| System database (accounts, sessions, mailboxes) | SQLCipher, key derived from CLIPR_SECRET_KEY |
| Ticket store per account | SQLCipher with its own data key; files additionally AES-256-GCM |
| Vault (optional per person) | Data key only with the vault password or recovery code – not even the operator can open it |
| IMAP passwords of mailboxes | encrypted with a purpose key derived from CLIPR_SECRET_KEY |
| Account passwords | scrypt following OWASP recommendations |
Separate keys for every purpose are derived from CLIPR_SECRET_KEY via HKDF. It is therefore the one value you have to protect and back up separately – and must never change. cliprctl locks it against accidental changes.
Wiki sign-in (single sign-on)
The wiki has no accounts of its own. Whoever wants to edit signs in via Clipr; Clipr issues a short-lived, signed, one-time ticket for that.
sequenceDiagram participant B as Browser participant W as Wiki participant C as Clipr B->>W: Sign in W->>B: state cookie, continue to Clipr B->>C: /sso/authorize?client=wiki&state=… Note over C: Admin? 2FA requirement met? C->>B: back to the wiki with ticket (valid 60 s) B->>W: /_auth/callback?ticket=…&state=… Note over W: signature, issuer, audience, expiry, one-time use, state W->>B: own session (cookie) W->>C: on every change: is the sign-in still valid?
No admin access across installations:
- Every Clipr installation creates its own Ed25519 key pair. A ticket from another installation fails on the signature and the issuer.
- The ticket names exactly one audience (the origin of this wiki), the account ID of this installation – never the email address, which anyone could register elsewhere –, is valid for 60 seconds and only once.
- It only matches the browser that started the sign-in (state cookie), which prevents forced sign-ins.
- Clipr only redirects to fixed origins (
CLIPR_WIKI_DOMAIN,CLIPR_SSO_CLIENTS); there is no freely chosen return address. - Tickets are only issued to admins whose session meets the administration 2FA requirement (
CLIPR_2FA_REQUIRED). - On every change the wiki asks Clipr whether the sign-in is still valid. Signing out of Clipr, a revoked admin role or a disabled account take effect immediately. If Clipr is unreachable, editing is not possible.
- The wiki receives neither
CLIPR_SECRET_KEYnor the app's.env.
Protection of the private key:
- It is created inside the app and only stored encrypted: AES-256-GCM with a key derived from
CLIPR_SECRET_KEYsolely for this purpose, bound to the key ID, additionally inside the SQLCipher-encrypted system database. - No endpoint, no command and no log outputs it. Only the public key leaves the app (
/sso/keys). - It is never part of an image and never inside the wiki container. A compromised website or wiki therefore cannot issue tickets.
Show and rotate keys:
docker compose exec app python -m clipr.cli sso-keys # public keys and registered services
docker compose exec app python -m clipr.cli rotate-sso-key # new pair; the old one still verifies for an hour
Rotating makes sense as a routine or after an incident in which only the private key itself might be affected. It does not help if CLIPR_SECRET_KEY has become known: the private key is exactly as safe as that secret, and the new one is encrypted with it too. In that case switch off wiki editing (CLIPR_WIKI_EDIT=0), remove further services from CLIPR_SSO_CLIENTS and have all passwords changed.
Web pages and content
- HTTPS everywhere, HSTS, TLS 1.2/1.3 only. Caddy's admin API is disabled.
- Strict Content Security Policy: scripts only from own files, no
eval, no embedding in foreign pages. - Cookies with the
__Host-prefix,HttpOnly,Secure,SameSite; state-changing requests need a custom header and the matching origin (CSRF protection). - Wiki on its own hostname: wiki content (including allowed HTML) runs on a different origin than the app and can never reach its session.
- Wiki content is sanitised – when displayed and in the preview, regardless of who wrote it. Details under Running the wiki.
- Foreign files (PDFs, images, emails) are analysed in a sandbox without access to keys, with memory and time limits (Landlock).
- SSRF protection: mail servers in private networks only when explicitly allowed.
Containers
- All containers without additional Linux capabilities, with
no-new-privileges, read-only file system, memory and process limits. - The app runs as user
10001, the wiki as10002; code and libraries belong to root and are read-only for them. - Only Caddy is reachable from outside; app and wiki only within the internal Docker network.
Operations checklist
-
CLIPR_SECRET_KEYbacked up separately from the server -
.envwith mode 600 (scripts/cliprctl healthchecks this) - Initial password removed from
.env - Two-factor sign-in set up for admins (
CLIPR_2FA_REQUIRED=adminsorall) - Registration as open as needed, as closed as possible
- Regular backups with a copy on another device
- Apply updates promptly (
scripts/cliprctl update), keep base images current (--pull) - Only enable wiki editing when needed (
CLIPR_WIKI_EDIT)