Zero-Knowledge-Platform/SECURITY_NOTES.md
2026-10-08 02:41:41 +05:30

2 KiB

Security Notes

Zero-Knowledge Guarantees

  • Encryption and decryption happen only in the browser with the Web Crypto API.
  • The backend only stores opaque iv + ciphertext blobs plus metadata.
  • The backend never receives the plaintext data content for parent or child records.
  • The backend never receives the encryption key.
  • Password-derived auth material is separate from password-derived encryption material.
  • The auth branch uses saltAuth and the encryption branch uses saltEnc.
  • Parent deletion cascades to children using a backend transaction that still only handles encrypted blobs.
  • No password reset or account recovery flow exists.

Backend Safety Checks

  • No application logger or print() statements emit plaintext, password material, or derived keys.
  • API responses avoid plaintext content and do not echo secrets.
  • JWT expiry is enforced with ACCESS_TOKEN_EXPIRE_MINUTES.
  • There is no refresh-token flow, so refresh handling cannot expose content.
  • Ownership is derived from the JWT sub claim, not from client-supplied owner IDs.
  • Content queries are scoped by ownerId and parentId only.

Operational Limits

  • Full zero-knowledge security depends on the browser/client device being trusted.
  • Server-side search over decrypted content is intentionally unsupported.
  • Server-side content indexing is intentionally unsupported.
  • If a user forgets their password, encrypted data is permanently unrecoverable.
  • Production MongoDB should use a least-privilege app user, not an admin account.
  • Production deployments should keep secrets out of source control and rotate JWT secrets on a policy schedule.

Notes

  • The current development setup uses a local MongoDB service for convenience.
  • The frontend keeps the encryption key only in React memory for the active session.
  • Any future feature should be checked against the rule: does the server need plaintext? If yes, redesign it to run client-side.