Merge commit from fork

The Login V1 MFA init/enrollment handlers acted on authReq.UserID via
setUserContext without verifying the auth request had completed its
first factor. A request that only submitted a loginname could enroll
TOTP/SMS/Email/U2F factors and overwrite the victim's phone number, and
the discrepant errors bypassed IgnoreUnknownUsernames.

Gate the enrollment handlers on PossibleSteps[0] == *domain.MFAPromptStep,
which nextSteps only yields after firstFactorChecked passes.

Co-authored-by: Claude Opus 4.8 <[email protected]>
This commit is contained in:
gayathri
2026-08-14 06:12:04 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 8a61aa4f36
commit 522b0ed7ed
6 changed files with 114 additions and 0 deletions
@@ -31,6 +31,9 @@ func (l *Login) handleMFAInitVerify(w http.ResponseWriter, r *http.Request) {
l.renderError(w, r, authReq, err)
return
}
if !l.checkMFAPromptStep(w, r, authReq) {
return
}
var verifyData *mfaVerifyData
switch data.MFAType {
case domain.MFATypeTOTP: