Hi, Mridul

Thanks for the re-test. All the points from your last comment are addressed:

*Blocking*

- *The cleanAll loadAll failure was a load-order problem:* the purge job's
JobSandbox row pointed at MIDNIGHT_DAILY, a TemporalExpression that only
exists once the service component loads, which happens after security. It
now defines its own daily-midnight expression locally instead of
referencing that one.
A fresh cleanAll loadAll runs clean now.

- *Merged current trunk into the branch and resolved the conflicts in
APIAuthFilter.java and ofbiz-**component.xml *— APIAuthFilter.java keeps
both trunk's new disabled/de-authorized-token check and the existing MFA
policy check; ofbiz-component.xml keeps both the purge-job data entry and
trunk's security.AuthorizationCache addition.
The EntityUtilProperties import HttpBasicAuthFilter needs is back, and it
compiles and builds clean.

- *Service-level login (the login.username/login.password path) no longer
resets the lockout counter *or establishes a session for an MFA-mandated
account on a correct password, verified live: two wrong passwords brought
the counter to 2, then a correct-password service-level call left it at 2,
not 0.

***On re-testing with SetTimeZoneFromBrowser specifically, *that service
has its own pre-existing, unrelated exemption from the auth-required check
(OFBIZ-13061), so its HTTP response stays 200 regardless.

- *The username-casing bypass is closed on both paths:* The check for
whether an account has MFA enrolled now runs against the normalized
username on the web login (LoginWorker.login) and the REST Basic-Auth login
(HttpBasicAuthFilter), each with its own dedicated regression test.

*Should fix*

- *A wrong code entered during enrollment* or while generating backup codes
now counts against the lockout, the same as a wrong code at the regular
re-verify step.

- *Revoking a factor now always requires a recent successful MFA proof*,
even if the current password is correct and even after the
re-authentication window would otherwise still be open.

- *The JWT login path no longer leaves a session half-logged-in:* if the
MFA check fails closed, the session is cleaned up before returning the
error, not left with a userLogin still attached.

- *An unknown or disabled certificate CN* falls through the same way
trunk's did, instead of hard-failing.

check, javadoc, checkstyleTest, codenarcMain/codenarcTest, and the
integration suite are green on current HEAD, including a fresh cleanAll
loadAll.

Let me know if anything else comes up.

*PRs:* #2620 (framework)
<https://github.com/apache/ofbiz-framework/pull/2620>, #523 (plugins)
<https://github.com/apache/ofbiz-plugins/pull/523>



Kind Regards,
Krishna Uprit
Application Security Engineer
*HotWax Systems*
*Enterprise open source experts*
cell: +91-7999304341 <+91%2079993%2004341>
http://www.hotwaxsystems.com

On Wed, Nov 25, 2026 at 9:54 PM Mridul Pathak via dev <[email protected]>
wrote:

> Hi Krishna,
>
> Thanks for the quick turnaround. I re-tested both PRs and everything from
> the last round holds: the timed lockout recovers, the REST counter and
> error response are right, forced enrollment logs in directly, the re-verify
> step counts wrong codes, and the form macros match trunk again.
>
> A few new points came up, and the details are in a comment on the framework
> PR (
> https://github.com/apache/ofbiz-framework/pull/2620#issuecomment-7167782357
> ).
> The ones that block the merge are:
>
> * A fresh cleanAll loadAll fails, because the new purge job is loaded
> before the temporal expression it refers to.
> * A service call with login.username and login.password resets the
> failed-login counter, so the lockout can be avoided that way.
> * With username.lowercase enabled and MFA switched off, an enrolled user
> can log in without the second factor by typing the username in upper case.
>
> With the data load fixed locally, the checks and the integration tests pass
> for me. I think we are close, and once these are addressed I would be happy
> to see it merged, with the smaller items handled as follow-ups.
>
> Regards,
> Mridul Pathak
>
> On Tue, Nov 24, 2026 at 6:31 PM Krishna Uprit <
> [email protected]> wrote:
>
> > Hi Mridul,
> >
> > Thanks for re-testing — good to hear the earlier fixes held up. Addressed
> > everything below on both PRs.
> >
> > *Blocking*
> >
> > - Timed lockouts now clear correctly with MFA enabled: the
> > login.disable.minutes re-enable was gated behind !deferSuccessCommit, so
> it
> > never ran on an MFA-pending login. Restored unconditionally, with a
> narrow
> > doStore path so the rest of the commit still stays deferred until MFA
> > completes.
> >
> > - HttpBasicAuthFilter now sends plain username/password to
> > userLoginMfaPending instead of login.username/login.password —those keys
> > were triggering ServiceDispatcher.checkAuth()'s own pre-auth, committing
> > successiveFailedLogins/UserLoginHistory on every REST token call
> regardless
> > of MFA state.
> >
> > - A wrong code on the REST verify endpoint now returns the intended error
> > instead of a 400 — verifyRestMfaChallenge() was passing a null Locale
> into
> > UtilProperties.getMessage(), which throws instead of localizing.
> >
> > - Forced enrollment no longer replays its confirming code against the
> login
> > challenge it already satisfies — confirmForcedTotpEnrollment marks that
> > challenge VERIFIED directly and completes the login via a shared
> > completeVerifiedMfaLogin().
> >
> > - reverifyAuthFactor now counts a wrong code toward the account-wide
> > lockout (it had no challenge of its own to rate-limit on before), and
> > generateBackupCodes always requires the current password, matching
> > createUserLoginTotpFactor/revokeUserLoginAuthFactor.
> >
> > - An enrolled user is now challenged consistently regardless of the
> global
> > switch — form login, the header/cert/remote-user/Tomcat-SSO path, and JWT
> > all fall back to hasActiveFactor() like REST already did. The
> preprocessor
> > path also stopped setting PRIMARY_VERIFIED on its own, since that could
> > finish a login without a verified challenge now that it can require MFA
> for
> > real.
> >
> > - Added reverifyAuthFactor to the storefront (request-map,
> screen/template,
> > and the authFactorRequired response on
> > revokeMfaFactor/generateBackupCodes).
> >
> > - APIAuthFilter and checkJWTLogin now check ServiceUtil.isError() on the
> > isUserLoginMfaRequired result, not just a thrown exception; added
> > APIAuthFilterMfaFailClosedTests alongside the existing
> > AuthenticationResourceMfaFailClosedTests.
> >
> > *Should fix*
> >
> > - testMfaBackupRecoveryCodes compiles and passes again (missing
> > HashCrypt/LoginServices imports).
> >
> > - Restored the title separator and &nbsp; in HtmlFormMacroLibrary.ftl,
> > emptied by the base commit unrelated to MFA.
> >
> > - Corrected the guide's password-change-gating claim — that integration
> was
> > already reverted; reworded to describe what the gate actually covers
> > (backup-code generation and factor revocation).
> >
> > - Also corrected the entity count (three new entities plus one field on
> > SecurityGroup, not four), challengeStatus's listed values
> > (PENDING/VERIFIED/CONSUMED/LOCKED, not EXPIRED), and the eventType list
> > (was missing several real values and listed one,
> MFA_ADMIN_PASSWORD_RESET,
> > that nothing records); replaced a stale admin-recovery reference and
> added
> > the missing totpWindowSteps config line.
> >
> > - Test-suite counts fixed too — and added the two REST MFA fail-closed
> test
> > suites that weren't listed at all.
> >
> > *Housekeeping*
> >
> > - Updated the PR title and descriptions in both ofbiz-framework and
> plugins
> > (PNG, not SVG; covers backup codes and the re-verify flow).
> >
> > - beginForcedTotpEnrollment is POST-only on both the framework and
> > storefront controllers; the purge job is now scheduled daily off the
> shared
> > MIDNIGHT_DAILY expression.
> >
> > - Externalized one remaining hardcoded "MFA Setup" link label
> > (flatgrey/helveticus/rainbowstone) the earlier UI-text pass had missed.
> >
> >
> > *Updated Proposal Doc:*
> >
> >
> https://docs.google.com/document/d/1v-ckX-nNaUrkK4dbs37LuTDN572hLdmc3wQKeilB7nY/edit?usp=sharing
> >
> > *PRs:* #2620 (framework)
> > <https://github.com/apache/ofbiz-framework/pull/2620>, #523 (plugins)
> > <https://github.com/apache/ofbiz-plugins/pull/523>
> >
> > Please let me know if anything requires further clarification.
> >
> >
> >
> > Kind Regards,
> > Krishna Uprit
> > Application Security Engineer
> > *HotWax Systems*
> > *Enterprise open source experts*
> > cell: +91-7999304341 <+91%2079993%2004341> <+91%2079993%2004341>
> <+91%2079993%2004341>
> > http://www.hotwaxsystems.com
> >
> > On Mon, Nov 23, 2026 at 1:05 PM Mridul Pathak via dev <
> > [email protected]>
> > wrote:
> >
> > > Hi Krishna,
> > >
> > > Thanks for the update and for working through everything so
> thoroughly. I
> > > applied both PRs on current trunk again and re-tested with MFA enabled,
> > > disabled, and enabled together with header login.
> > >
> > > What I can confirm from testing:
> > >
> > > * Wrong codes now count towards the account lockout on the web login.
> > > * An account disabled while it waits at the challenge page stays
> disabled
> > > and is not logged in.
> > > * The REST verify step is tied to the API group of the challenge, and
> the
> > > login history is written only after the second factor.
> > > * Backup codes, replay rejection and the new re-verify step all work.
> > > * With MFA disabled, the REST token endpoint and the normal lockout
> > > recovery behave as before.
> > >
> > > A few things still need work before it can be merged. I have put the
> > > details in a comment on the framework PR (
> > >
> >
> https://github.com/apache/ofbiz-framework/pull/2620#issuecomment-7094327612
> > > ),
> > > the main ones being:
> > >
> > > * With MFA enabled, a timed lockout is never lifted, also for users who
> > > have no factor.
> > > * On REST, each token request resets the failed-login counter, so the
> > > lockout is not reached there.
> > > * One of the new integration tests fails, and the form macro change in
> > the
> > > common theme is still in.
> > >
> > > On the SSO limitation you describe (header, JWT, remote user and
> > > certificate logins cannot show the challenge), I confirmed that these
> > > logins fail closed: a user who needs a second factor is simply not
> logged
> > > in, so there is no way around the factor. I am fine with documenting it
> > for
> > > a first version, since the feature is off by default and a trusted
> proxy
> > > can be configured. If anyone on the list sees a problem with shipping
> it
> > > that way, it would be good to hear it now.
> > >
> > > Happy to test again once the remaining points are addressed.
> > >
> > > Regards,
> > > Mridul Pathak
> > >
> > > On Sat, Nov 21, 2026 at 4:39 PM Krishna Uprit <
> > > [email protected]> wrote:
> > >
> > > > Hi Mridul,
> > > >
> > > > Thanks for the detailed review and for testing this locally — really
> > > > helpful. I've addressed everything below on both PRs; commit-level
> > detail
> > > > and the full channel-by-channel behavior matrix are in the linked
> > > document.
> > > >
> > > >
> > > > *  Testing findings:*  - Failed second-factor attempts now increment
> > > > successiveFailedLogins too (not just the per-challenge counter), on
> > both
> > > > the web and REST paths, disabling the
> > > >     account at the same threshold a wrong password would.
> > > >   - An account disabled while the user is waiting at the challenge
> > screen
> > > > now fails at completion instead of being logged in and silently
> > > re-enabled
> > > > — both
> > > >     the challenge-verification step and markSuccessfulLogin itself
> > > re-check
> > > > the enabled flag before finishing the login.
> > > >   - The REST challenge's own sessionBindingHash now decides which API
> > > group
> > > > a token is minted for; a mismatched group path is rejected, and the
> > > group's
> > > >     configured base permission is checked before issuing it.
> > > >   - Basic Auth no longer runs the committing userLogin service up
> > front —
> > > > it defers to the non-committing userLoginMfaPending, and only commits
> > > >     (UserLoginHistory, lockout reset) once the second factor is
> > actually
> > > > satisfied.
> > > >   - Added a reverifyAuthFactor endpoint: a gated action whose proof
> has
> > > > gone stale now stashes what the user submitted and replays it
> > > automatically
> > > > once they
> > > >     re-verify, instead of just failing.
> > > >   - Header/JWT/remote-user/certificate logins: It's a RequestHandler
> > > > preprocessor-chain constraint— these paths can't
> > > >     currently surface a challenge view even when the primary auth
> > > succeeds
> > > > — and fixing it properly looked like it needed a core framework
> change,
> > > not
> > > > an
> > > >     MFA-scoped one. I've documented it as a known limitation for now
> > > rather
> > > > than ship a partial workaround.
> > > >
> > > >
> > > > *  Design points:*  - Added single-use backup recovery codes
> > > (ULAF_BACKUP)
> > > > on both the web and storefront, and stopped blocking forgot-password
> > > email
> > > > recovery for MFA accounts
> > > >     — it never bypassed the second factor to begin with.
> > > >   - Added the channel-by-channel doc as being asked for
> (sy-MFA.adoc),
> > > > covering every entry point and how each behaves under MFA, including
> > the
> > > > limitation above.
> > > >   - Replaced dev.samstevens.totp with a small, self-contained
> TOTP/HOTP
> > > > implementation on javax.crypto, verified against all 6 RFC 6238
> > Appendix
> > > B
> > > > test
> > > >     vectors.
> > > >   - Switched the REST token's amr claim from "totp" to the RFC
> > > > 8176-registered "otp"/"fido", and added WebAuthn/passkey slots to the
> > > > factor-type enumeration
> > > >     so neither needs a schema change later.
> > > >
> > > >
> > > > *  Smaller things:*  - Corrected the doc/code mismatches listed: QR
> > code
> > > is
> > > > a PNG data URI (not SVG), there's no acr claim or totp.window
> property
> > > > (it's totpWindowSteps, a
> > > >     clock-drift setting, not a re-auth window), and the re-auth
> window
> > is
> > > > 300 seconds.
> > > >   - Reverted updatePassword routing, the common-theme password macro,
> > and
> > > > the external login key lifetime back to their pre-MFA state on the
> > > > framework side,
> > > >     and mirrored the updatePassword revert on the storefront, so
> > nothing
> > > > changes for non-MFA deployments.
> > > >   - Externalized the hardcoded UI text on both the framework and
> > > > storefront, and removed Working.md from the repo root — its content
> is
> > > > already covered more
> > > >     accurately by sy-MFA.adoc.
> > > >
> > > > *Updated Proposal Doc:*
> > > >
> > > >
> > >
> >
> https://docs.google.com/document/d/1v-ckX-nNaUrkK4dbs37LuTDN572hLdmc3wQKeilB7nY/edit?usp=sharing
> > > >
> > > > *PRs:* #2620 (framework)
> > > > <https://github.com/apache/ofbiz-framework/pull/2620>,  #523
> (plugins)
> > > > <https://github.com/apache/ofbiz-plugins/pull/523>
> > > >
> > > > Please let me know if anything requires further clarification.
> > > >
> > > >
> > > > Kind Regards,
> > > > Krishna Uprit
> > > > Application Security Engineer
> > > > *HotWax Systems*
> > > > *Enterprise open source experts*
> > > > cell: +91-7999304341 <+91%2079993%2004341> <+91%2079993%2004341>
> <+91%2079993%2004341>
> > <+91%2079993%2004341>
> > > <+91%2079993%2004341>
> > > > http://www.hotwaxsystems.com
> > > >
> > >
> >
>

Reply via email to