Skip to content

Fix incorrect crypto and key details in documentation - #125

Merged
umputun merged 2 commits into
umputun:masterfrom
paskal:fix-doc-accuracy
Aug 20, 2026
Merged

Fix incorrect crypto and key details in documentation#125
umputun merged 2 commits into
umputun:masterfrom
paskal:fix-doc-accuracy

Conversation

@paskal

@paskal paskal commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Documentation in README.md and CLAUDE.md describes several security properties that do not match the implementation.

  • README said server-side encryption is AES-256-GCM. app/messager/crypt.go uses NaCl secretbox, XSalsa20-Poly1305; the file itself says so at line 15.
  • README said PIN hashing uses bcrypt cost 14. app/messager/messager.go:236 calls bcrypt.GenerateFromPassword with bcrypt.DefaultCost, which is 10.
  • README said random key generation is 32 bytes. The browser generates a 128-bit key (crypto.js, generateKey) and store.GenerateID produces a 12-character base62 id; nothing generates a 32-byte random key.
  • README said the server rejects unencrypted content from web clients. validator.IsBase64URL checks the base64url alphabet and a minimum length consistent with an IV plus tag, so it validates the shape of a ciphertext envelope rather than establishing that the content is encrypted.
  • CLAUDE.md said messages are stored under a UUID key. app/store/store.go:29 generates a 12-character base62 id.
  • CLAUDE.md said the IP anonymisation hash is 12-char HMAC-SHA1. app/server/middleware.go:84-88 uses HMAC-SHA256 truncated to 8 hex characters.
  • CLAUDE.md's data flow said MessageProc encrypts every message. That holds for the API path only, since ClientEnc messages are stored exactly as the browser sent them (app/messager/messager.go:140-141).

The MakeSignKey comment still referred to AES256 as well.

Documentation only, no behaviour change.


The e2e job fails on this branch for a reason unrelated to it: the playwright driver can no longer be installed, which has been breaking every run since 1 July. #126 fixes that, and its e2e run is green.

Previously, README described server-side encryption as AES-256-GCM and PIN
hashing as bcrypt cost 14, while `app/messager/crypt.go` uses NaCl secretbox
(XSalsa20-Poly1305) and `app/messager/messager.go` calls bcrypt with
`bcrypt.DefaultCost`, which is 10. It also claimed 32-byte random key
generation, where the browser generates a 128-bit key in `crypto.js` and
`store.GenerateID` produces a 12-character base62 id, and said the server
rejects unencrypted content from web clients, where
`validator.IsBase64URL` only checks the alphabet and a minimum length
consistent with an IV plus tag. The API examples still showed UUID keys.

CLAUDE.md described storage keys as UUIDs and the IP anonymisation hash as
12-char HMAC-SHA1, while `app/store/store.go` generates 12-character base62
IDs and `app/server/middleware.go` truncates an HMAC-SHA256 to 8 hex chars.
Its data flow also described encryption and decryption as always happening
in MessageProc, which holds for the API path only: `ClientEnc` messages are
stored as received and handed back as ciphertext, and the browser decrypts
them after the server has already deleted the record.

The `MakeSignKey` comment still referred to AES256 as well.
@umputun
umputun merged commit abd715c into umputun:master Aug 20, 2026
4 checks passed
@paskal
paskal deleted the fix-doc-accuracy branch August 20, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants