Skip to content

Comments

FINERACT-2004: Limit login retries#5443

Open
airajena wants to merge 1 commit intoapache:developfrom
airajena:FINERACT-2004/limit-login-retries
Open

FINERACT-2004: Limit login retries#5443
airajena wants to merge 1 commit intoapache:developfrom
airajena:FINERACT-2004/limit-login-retries

Conversation

@airajena
Copy link
Contributor

@airajena airajena commented Feb 4, 2026

Description

Adds a configurable global setting to limit login retries and lock accounts after exceeding the configured threshold. Failed attempts are tracked per user, and a successful login resets the counter. This aligns with FINERACT-2004 and provides safer, configurable account protection without changing public APIs.

Key changes

  • New global configuration max-login-retry-attempts (enabled flag + value).
  • Track failed_login_attempts on m_appuser and lock the user when the threshold is reached.
  • Reset failed attempts on successful authentication.
  • Added unit tests for login attempt handling and updated integration-test defaults.
  • Updated API docs with the new configuration entry.

Testing

  • ./gradlew :fineract-core:spotlessApply :fineract-core:spotbugsMain :fineract-core:spotbugsTest :fineract-core:checkstyleMain :fineract-core:checkstyleTest
  • ./gradlew :fineract-provider:spotlessApply :fineract-provider:spotbugsMain :fineract-provider:spotbugsTest :fineract-provider:checkstyleMain :fineract-provider:checkstyleTest
  • ./gradlew :integration-tests:spotlessApply :integration-tests:spotbugsMain :integration-tests:spotbugsTest :integration-tests:checkstyleMain :integration-tests:checkstyleTest

Checklist

@airajena airajena force-pushed the FINERACT-2004/limit-login-retries branch 4 times, most recently from b44c9df to 2ba7017 Compare February 5, 2026 11:08
@airajena
Copy link
Contributor Author

airajena commented Feb 8, 2026

Hi @adamsaghy , i checked the failed check
It shows 429 (Too Many Requests), I think this is not a code error. Re running might resolve.

@airajena airajena force-pushed the FINERACT-2004/limit-login-retries branch 2 times, most recently from 9474e14 to 5ac562f Compare February 11, 2026 15:36
@adamsaghy
Copy link
Contributor

@airajena Please rebase this PR with latest develop branch!


@Getter
@Column(name = "failed_login_attempts", nullable = false)
private int failedLoginAttempts;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to introduce a new flag which controls whether this functionality is allowed on a particular account or not.

For example, the system account should NEVER be locked! Probably same applies to accounts which are used for API communication!

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly see my concerns!

@airajena airajena force-pushed the FINERACT-2004/limit-login-retries branch 2 times, most recently from baefdaa to 226afac Compare February 17, 2026 18:11
@adamsaghy
Copy link
Contributor

@airajena Please rebase.

@airajena
Copy link
Contributor Author

@airajena Please rebase.

done, resolved the merge conflicts

<column name="failed_login_attempts" type="INT" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="is_login_retries_enabled" type="BOOLEAN" defaultValueBoolean="true">
Copy link
Contributor

@adamsaghy adamsaghy Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dont enable it by default!

Let it be false automatically, and which ever accounts they want to enable, they can do it manually. Existing deployments might already using users for different situations where limiting is not needed.


@Getter
@Column(name = "is_login_retries_enabled", nullable = false)
private boolean loginRetriesEnabled;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name is misleading. This is a flag to control whether login retries are limited or not. Please make sure it reflects it.

}

private static boolean isDefaultLoginRetriesExemptUser(final String username, final Boolean cannotChangePassword) {
return AppUserConstants.SYSTEM_USER_NAME.equalsIgnoreCase(username) || Boolean.TRUE.equals(cannotChangePassword);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The system user part i got, but the cannot change password is why needed?

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly see my concerns!

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.

2 participants