Skip to content

Feat/breached password check - #8

Merged
raymondproguy merged 8 commits into
mainfrom
feat/breached-password-check
Sep 3, 2026
Merged

Feat/breached password check#8
raymondproguy merged 8 commits into
mainfrom
feat/breached-password-check

Conversation

@raymondproguy

Copy link
Copy Markdown
Contributor

No description provided.

Ships zero implementations — checking this necessarily means an
outbound network call (e.g. to HIBP's k-anonymity API), and the
engine never talks to the internet on its own initiative anywhere
else, so it doesn't start here. The consuming app implements this
against HIBP, a self-hosted breached-password list, or anything else
that fits.
Both take an optional breachChecker now. A confirmed breach rejects
the password with ErrPasswordBreached (and records a
password_breach_rejected audit event); a checker error fails open —
logged, not treated as a rejection, since blocking account creation
on a third-party API's uptime is a worse tradeoff than the security
gained.

On ChangePassword specifically, the check runs AFTER the current-
password verification — a caller can't probe the new password's
breach status without already proving they own the account.

New Config.BreachedPasswordChecker field (optional). Public facade
signatures for SignUp/ChangePassword are unchanged.

Updates existing signup_test.go/account_test.go call sites for the
new param.
Covers: a confirmed breach rejecting SignUp/ChangePassword, a checker
error failing open, the current-password check running before the
new-password breach check on ChangePassword (and the checker never
being called in that case), and the rejection being recorded as a
password_breach_rejected audit event.
Runnable end-to-end check with no database dependency: go run
./cmd/smoketest/breached-password-check. Uses two tiny local fake
checkers (not a real HIBP client — see the testing doc for why) to
demonstrate the actual contract: a confirmed breach rejects the
password, a checker error fails open, and a clean password with no
breach succeeds.

(The 'checker skipped when policy already rejects' case is covered
once password policy exists — see the follow-on branch.)
@raymondproguy
raymondproguy merged commit 5919a5e into main Sep 3, 2026
1 check failed
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.

1 participant