Harden sign-in flow: antiforgery, TOTP challenge, generic 2FA pages #7
Loading…
Reference in a new issue
No description provided.
Delete branch "d/auth-hardening"
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?
Sign-in POSTs now validate antiforgery tokens and the shipped login forms supply them. Adds the SignInWith2fa TOTP challenge action and reworks the 2FA pages to SSR form posts so auth cookies are set reliably and derived user types resolve.
🤖 Claude AI Code Review
Summary
Hardens the sign-in flow with antiforgery validation, adds a dedicated
SignInWith2faaction, and reworks the 2FA/recovery pages to SSR form posts so auth cookies set reliably across derived user types.Code Quality ⭐⭐⭐⭐☆
Solid architectural fix — the SSR-post-to-controller approach correctly addresses the broken cookie-setting on interactive circuits, and the non-generic
IAccountIdentityServicebridge is a clean solution for derivedTUser.Issues
🟡 AccountController.cs —
SignInWith2fausesisPersistent: truewhile the original interactive flow usedmodel.RememberMachinefor persistence. This is documented as intentional (matchingSignIn), but note it silently changes 2FA login to always-persistent regardless of user choice. Confirm this is desired product behavior.🟢 LoginWith2fa.razor / LoginWithRecoveryCode.razor — the removed pages previously validated the two-factor session in
OnInitializedAsyncand redirected to login if absent. Now the pages render unconditionally; the session check only happens on POST. Acceptable (controller redirects), but users landing directly without a 2FA session will see a form that just bounces to login on submit.The antiforgery hardening, null-guarding of form fields, and SSR rework are all correct and improve security. The persistence-behavior change is worth a quick confirmation but isn't a blocker.
📊 Tokens: 14575 input + 529 output | 💰 Cost: ~$0.0861
Generated by Claude Opus 4.8 via Gitea Actions