If you find a security vulnerability in DocuBook, do not open a public issue. Report it privately instead:
- Email: email@wildan.dev
- Subject prefix:
[SECURITY]
Please include:
- The affected version(s)
- A description of the vulnerability and its impact
- Steps to reproduce (or a minimal PoC)
- Any suggested fix, if you have one
- You will get an acknowledgement within 48 hours.
- The issue is triaged and a fix is prepared (no public disclosure until it ships).
- Once fixed, we coordinate disclosure — typically with a release note, and credit in the changelog if you wish.
The Rust backend (src-tauri) is the trust boundary; the webview is treated as untrusted. Reports involving path traversal, SSRF, XSS, key handling, or IPC authorization are especially welcome.
Trust boundary & keys — the Rust backend (desktop src-tauri, web server/) is the trust boundary; the webview/browser is untrusted. API keys are backend-only and never sent to the webview (list_keys returns provider names only, never key material).
API-key storage
- Desktop: macOS Keychain (
securityCLI). - Web (Docker):
keys.jsonin/data, mode0600. Plaintext by default; set theDB_KEYS_PASSPHRASEenv var to enable AES-256-GCM encryption at rest (key derived from the passphrase via Argon2id, fresh salt per file). - The passphrase protects the file at rest only — the real API key still flows to the provider
Authorizationheader per request. - Migration & guards: a plaintext file auto-migrates to encrypted on first access when the passphrase is set; an encrypted file is never overwritten when the passphrase is missing; a wrong passphrase yields an error, never garbage.
Git credentials
- Desktop: the app stores none. It uses the machine's own Git setup: the credential helper from the global or
/etcGit config,ssh-agent, and~/.sshkeys. Certificate and SSH host-key verification are never weakened. - Web (Docker):
git-credentials.jsonin/dataholds HTTPS access tokens per host.- The file is always AES-256-GCM encrypted with the
DB_KEYS_PASSPHRASE-derived key. There is no plaintext mode, and saving is refused while the passphrase is unset. - Writes go to a
0600temp file that is then renamed into place. - The listing returns hosts and usernames only. A token is never sent back to the browser.
- A stored token is offered only to
https://remotes on the matching host. It is never offered over plain HTTP or to SSH, and it is tried once per operation, so a rejected token is reported instead of replayed.
- The file is always AES-256-GCM encrypted with the
- Prefer a token scoped to the vault's repository. Every account that can sign in can push with it.
Deployment hardening — decide at first boot
DB_SETUP_TOKEN— optional fixed setup token. If unset, the server prints a one-time token to its log at first boot and the wizard requires it, so no one can claim the admin account before you do. The token changes on restart until the admin exists.DB_KEYS_PASSPHRASE— set from first boot and keep it in your secret manager; losing it makes stored keys and Git tokens unrecoverable. Without it the server logs akeys_plaintextwarning at startup, and Git access tokens cannot be saved.DB_TRUSTED_PROXY— comma-separated addresses or CIDR ranges of your reverse proxies, for example127.0.0.1for a proxy on the same host or172.18.0.0/16for a Docker network (a range keeps working when the proxy container gets a new address). Only a listed proxy'sX-Forwarded-Fornames the real client for the login rate limit, and the proxy must append to that header rather than pass the client's value through: nginxproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;(Traefik appends by default). Without a listed proxy the forwarded headers are ignored, and any request that passed through a proxy is treated as remote for the setup gate.- Caddy: list Caddy's address. Nothing else to set; Caddy writes
X-Forwarded-ForandX-Forwarded-Protoitself. - Traefik: list Traefik's address or its Docker network range. Keep the default; do not set
notAppendXForwardedFor. - nginx: list nginx and set
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;andproxy_set_header X-Forwarded-Proto $scheme;. With onlyX-Real-IPset, the client's ownX-Forwarded-Foris passed through; the server sees the two disagree and falls back to the proxy's address. - Cloudflare: to rate-limit per visitor, also list Cloudflare's published ranges (https://www.cloudflare.com/ips/). Unlisted, the Cloudflare edge address is used: coarser, but not spoofable. With a Worker in front, list Cloudflare only if the Worker sets
X-Forwarded-Foritself. Listing the ranges trusts every address in them, including the ones Workers send from, so whenever they are listed make the origin accept only your zone's traffic (Authenticated Origin Pulls or a Cloudflare Tunnel); otherwise a Worker someone else runs could reach the origin with anX-Forwarded-Forof its choosing. - HTTPS: the proxy must send
X-Forwarded-Proto: httpsfor session cookies to beSecure. For an HTTPS-only site, setDB_SECURE_COOKIE=1to force it regardless of the proxy.
- Caddy: list Caddy's address. Nothing else to set; Caddy writes
- Admin account — setup cannot be skipped. Create it before exposing the server; login remains required afterward.
Other controls — path-traversal-safe vault paths (safe_path), SSRF-guarded AI base URLs (allowlist + loopback only), sanitized AI error messages (no provider/URL leakage), CSP, and a web-only server-side trash (.trash/ inside the vault — persistent in /data, excluded from tree, search, and git staging).
| Version | Supported |
|---|---|
| v0.1.0-next and later | ✅ |
| Earlier pre-releases | ❌ |