Security
Kagaz aims to be secure by default without ever locking a family out of its own documents. These are the design choices and the trade-offs that come with them.
Kagaz is version 0.x and has not had an independent security audit. The full model is in SECURITY.md.
What is protected
| Threat | Protection |
|---|---|
| Someone copies the storage bucket or the disk | Each file is encrypted with its own random 256-bit key (AES-256-GCM), and that key is encrypted with MASTER_KEY. Document numbers, notes and remembered PDF passwords are encrypted too. |
| Someone copies the database | Passwords are stretched in the browser (PBKDF2-SHA256, 600,000 iterations) and the server stores only a salted hash of the result, so every guess still costs the full stretch. Recovery codes, session, invite, reset and API keys are stored as SHA-256 hashes. |
| Password guessing | Sign-in, recovery and key checks are rate limited. Unknown emails get the same answer as wrong passwords. Failed sign-ins are logged. |
| Cross-site attacks | HttpOnly, SameSite session cookies, a required custom header on every change, a strict Content-Security-Policy, and no framing by other sites. |
| Malicious uploads | File types are detected from content. Only JPEG, PNG and PDF are accepted, and they are served with a fixed type. |
| A lost phone | Sign out everywhere, or an admin disables the account. Sessions last 30 days and extend while used. |
| Leaked backups | Backups are encrypted in the browser with your passphrase. The server never sees it. |
| AI assistants | Per-person keys with read or read-and-add access, masked numbers, no PDF passwords, no deletes, and every call logged. See AI assistants. |
What Kagaz deliberately does not do
- It is not end-to-end encrypted. The server can decrypt files: it must, to share them with every family member and to allow password resets. Anyone with full control of the running server and its
MASTER_KEYcan read documents. If that worries you, host Kagaz on hardware you control. - Admins can reset other members' passwords. Only make someone an admin if you would trust them with the physical file folder.
- Password strength is checked in the browser. The server only sees stretched passwords, so a modified app could set a weak password for its own account.
- There is no two-factor sign-in yet. It is on the roadmap.
Keys and recovery
- Keep
MASTER_KEYsomewhere other than the server, such as a password manager or a printed sheet kept with your papers. - On Cloudflare,
MASTER_KEYis a Worker secret and can't be viewed again after saving, so keep your own copy. - For local setups without
MASTER_KEYset, Kagaz generates one atDATA_DIR/master.key. That protects against a leaked bucket, but not against someone who copies the whole data folder. Set the key from the environment for stronger separation.
Reporting a vulnerability
Please report security problems privately with a GitHub security advisory, not in a public issue.