feat(auth): server-side HIBP backstop on register, password reset, and password change #282
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip!282
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/BUNYIP-253-server-hibp-backstop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
BUNYIP-253: BUNYIP-240 shipped a client-side HIBP k-anonymity breach check on
/registerand/reset-password. The check is enforced by the SPA only; any non-browser POST (curl, automation, an XSS-controlled fetch from a malicious origin) bypasses it and lands a breached password in the DB. The audit named this high-severity.New
crates/bunyip-domain/src/services/password_breach.rsmirrors the client-side script: SHA-1 in-process, send only the first 5 hex chars tohttps://api.pwnedpasswords.com/range/{prefix}, scan the response for the 35-char suffix. The plaintext password never leaves the server.Wired into
AuthService::register,AuthService::complete_password_reset, andAuthService::change_passwordaftervalidate_strengthand before persisting. The change-password path was not in the audit's named list but shares the same shape and would otherwise be the next bypass vector.Failure mode: fail-open. An HIBP outage / 5xx / parse failure resolves to
Unknown -> falseand the registration proceeds, logged at warn. A network blip should not lock new users out; the BUNYIP-204 / server-sidevalidate_strength+ the BUNYIP-240 client-side check both stay in force as defense in depth.Privacy: the per-call reqwest client refuses redirects so a 302 from
api.pwnedpasswords.comcannot leak the SHA-1 prefix to a non-HIBP host. The 3s timeout keeps a slow upstream from holding the signup actor indefinitely.New
sha1 = "0.10"dep on bunyip-domain (HIBP uses SHA-1, the documented hash for the Pwned Passwords range query; not used for any other purpose).#BUNYIP-253