Files
loki/scripts/test
bb4bf5100f fix(api): /api/me hands the browser two credential digests (#306)
GET /api/me returned the Drizzle row verbatim, so every authenticated page
load shipped `passwordHash` and `privateZonePinHash` to the client. PATCH
did the same via .returning(). Both are the caller's OWN — this is not a
cross-account leak — but a credential digest in a page response is reachable
by everything the page is reachable by: an extension, an XSS, a logging
proxy, a screenshot of devtools. The PIN hash is the sharper end: it guards
the private zone and protects a short numeric secret, so an offline attempt
against it is cheap in a way a password hash is not.

Fixed as an allow-list, because the failure worth engineering against is not
these two fields — it is the secret column added next year to a route nobody
re-reads. Both halves are exhaustive over the schema, and
scripts/test/user-client-view.ts fails until every column in `users` is named
as exposed or withheld, each withheld one with its reason. Negative-tested in
both directions: removing a field from the list fails, re-exposing
passwordHash fails.

No client read either field — Settings, onboarding and the smoke test use
id/name/username/plan, and the private-zone UI needs only privateZonePinSetAt
(the fact a PIN exists), which stays.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 15:30:15 +00:00
..