Repository navigation
fix(security): harden MFA TOTP replay/rate-limit (P2-4a), SSRF, HTTP timeout, and password-reset session revocation - #400
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 404d93a964
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| store->revokeAllForUser( | ||
| std::to_string(userId), |
There was a problem hiding this comment.
Revoke browser sessions using the public subject
When a user resets their password, this passes the internal numeric user ID to ISessionStore::revokeAllForUser, but that API expects the public subject. Both MemorySessionStore and RedisSessionStore index sessions by publicSub, so this lookup revokes zero sessions while returning success. Other browsers, including one holding a stolen cookie, therefore retain their authenticated sessions despite the response claiming that all sessions were revoked. Capture and pass the publicSub already available in the enclosing callback instead.
Useful? React with 👍 / 👎.
…timeout, and password-reset session revocation - MFA / TOTP (P0): - Add constant-time TotpUtils::verifyCodeWithStep (avoids timeStep==0 underflow) and enforce RFC 6238 section 5.2 single-use monotonic step tracking under mutex in MfaService::verifyLoginCode and verifyAndEnable (prevents 90s-window and concurrent TOTP replay). - Wire P2-4a async IFailureRateLimiter into MfaController::verifyLogin (injected from IdentityAssembly for Redis multi-replica parity, with process-local RateLimiter fallback) to block 6-digit TOTP/backup-code brute force with 429 + Retry-After. - SSRF & outbound HTTP hardening (P1): - Upgrade RuleSet::validateBackchannelLogoutUri to full 8-hextet IPv6 + IPv4-mapped/compatible hex/dotted-quad + single-label decimal/hex IP + CGNAT/multicast + *.localhost/*.local + zone-id stripping. - Add explicit 10s outbound timeout and CT_APPLICATION_X_FORM in DrogonOAuthHttpClient. - Password reset session revocation (P1, P2-4b compatible): - Wire ISessionStore into PasswordResetController/PasswordResetService (from IdentityAssembly) and revoke all tracked browser sessions + clear current session on confirmReset (propagates cleanly through P2-4b RedisSessionStateBridge). - Tests: - Add 3 Domain GTests in MfaServiceTest (same-step replay, 8-thread concurrent race, setup replay/disable reset). - Add 3 integration tests in CoreSecurityConcurrencyHardeningTest (SSRF bypass vectors, sync RateLimiter 429, and P2-4a async IFailureRateLimiter 429). - Update PasswordLoginSessionStateHttpTest to use distinct TOTP step / backup code after MFA enrollment under RFC 6238 replay protection.
404d93a to
463544d
Compare
Summary
TotpUtils::verifyCodeWithStepand enforce RFC 6238 §5.2 single-use monotonic step tracking under mutex inMfaService::verifyLoginCodeandverifyAndEnable(blocks 90s-window and concurrent TOTP replay).IFailureRateLimiterintoMfaController::verifyLogin(injected fromIdentityAssemblywith process-local fallback) to block TOTP/backup-code brute force with429+Retry-After.RuleSet::validateBackchannelLogoutUriagainst IPv6/IPv4-mapped/hex/decimal/CGNAT/multicast/*.localhost/*.local/zone-id bypass forms.CT_APPLICATION_X_FORMinDrogonOAuthHttpClient.ISessionStoreintoPasswordResetController/PasswordResetServiceto revoke all tracked browser sessions and clear current session onconfirmReset.MfaServiceTestreplay/concurrency GTests andCoreSecurityConcurrencyHardeningTestintegration tests.PasswordLoginSessionStateHttpTestto use a distinct TOTP step / backup code after MFA enrollment under RFC 6238 replay protection.Verification
.\manage.ps1 build-backend(Windows MSVC Release): PASSMfaServiceTest+TotpUtilsTest(43/43) &CoreSecurityConcurrencyHardeningTest(3/3): PASSctest -C Release(config.ci.json): 767/768 passed (onlyHealth Live/Ready503 due to local Redis stopped)api_diff.py,check_spec_governance.py,migration_check.py,naming_validator.sh): PASS