Security Model
Defense-in-depth across setup credentials, revocable device tokens, WebSocket auth, HTTP headers, and audit logging.
Authentication & Credential Lifecycle
- One-time setup key (
SYNORA_API_KEY): Generated as 32 random bytes (64 hex chars) viaopenssl rand -hex 32during installation and stored with mode0600in.env. Used only when creating a vault (POST /api/vaults) and discarded by the client immediately afterward. - Per-device bearer tokens (
syn_dev_...): Each device receives its own high-entropy token (32 random bytes base64url-encoded). The server compares using constant-time equality for setup keys and stores onlySHA-256(token)for device tokens. - Instant device revocation: Revoking a device via Settings → Synora (or
POST /api/devices/:deviceId/revoke) setsrevokedAt, closes any active WebSocket for that device with code4001(device_revoked), invalidates unused pairing codes created by it, and rejects future API requests.
Transport & WebSocket Security
- No tokens in URL query strings:
server/src/ws.jsauthenticates/wsvia theAuthorization: Bearer ...header or an initial{ "type": "auth", "token": "..." }message within a 5-second timeout. Tokens are never passed in WebSocket query parameters where proxy or tunnel logs could capture them. - Security headers on every response:
X-Content-Type-Options: nosniffReferrer-Policy: no-referrerCache-Control: no-store(on all/api/*responses)
- Log redaction: Fastify logger redacts
req.headers.authorization,req.headers.cookie,*.deviceToken,*.pairingCode, and*.apiKey.
Abuse Protection & Auditability
- Sliding-window rate limiting: Both
POST /api/vaultsandPOST /api/pair/completeenforcePairingRateLimiter(default 15 failed attempts per 60 seconds per client IP). - Internal database isolation: In Standard Mode, CouchDB listens only on the private
synora-standardDocker bridge network; port5984is never bound to the host. - Vault audit log: Security events (
vault_created,e2ee_enabled,pairing_started,pairing_completed,device_revoked) are recorded per vault and viewable viaGET /api/auditand Settings → Synora → Security audit log.
Rotating the Setup Key
If you ever need to rotate SYNORA_API_KEY without affecting already-paired devices:
# 1. Generate a new 64-hex key
openssl rand -hex 32
# 2. Update SYNORA_API_KEY in deployment/lite/.env (or deployment/standard/.env)
# 3. Recreate only the api container:
cd /opt/synora/deployment/lite && sudo docker compose up -d --force-recreate api