-
Notifications
You must be signed in to change notification settings - Fork 2.3k
FINERACT-2005: Prohibit password re-use with configurable global setting #5367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
FINERACT-2005: Prohibit password re-use with configurable global setting #5367
Conversation
IOhacker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5ddd32b to
814bb25
Compare
| public static final String ASSET_OWNER_TRANSFER_OUTSTANDING_INTEREST_CALCULATION_STRATEGY = "outstanding-interest-calculation-strategy-for-external-asset-transfer"; | ||
| public static final String ALLOWED_LOAN_STATUSES_FOR_EXTERNAL_ASSET_TRANSFER = "allowed-loan-statuses-for-external-asset-transfer"; | ||
| public static final String ALLOWED_LOAN_STATUSES_OF_DELAYED_SETTLEMENT_FOR_EXTERNAL_ASSET_TRANSFER = "allowed-loan-statuses-of-delayed-settlement-for-external-asset-transfer"; | ||
| public static final String RESTRICT_REUSE_OF_PASSWORD = "restrict-reuse-of-password"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont like the naming. This global configuration serves a dual purpose:
- whether we want to restrict password reusage
- For the N last used password to be checked.
Can you please use something which fit better for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I've renamed it to PASSWORD_REUSE_CHECK_HISTORY_COUNT which I think better captures both purposes. Let me know if you'd prefer a different name.
| return null; | ||
| } | ||
| Long value = property.getValue(); | ||
| return value != null && value > 0 ? value.intValue() : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go with 0 if no value was provided, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! Now it returns 0 when enabled but no value is provided, instead of null
| if (aPreviewPassword.getPassword().equals(passWordEncodedValue)) { | ||
| throw new PasswordPreviouslyUsedException(); | ||
| final Integer passwordReuseRestrictionCount = this.configurationDomainService.getPasswordReuseRestrictionCount(); | ||
| if (passwordReuseRestrictionCount != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its enabled, but no value was provided, it is doing nothing which contradicts with the purpose of this field!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the logic so when it's enabled with value 0 (or no value), it now checks against ALL previous passwords for that user. This ensures password reuse is actually prevented when the feature is enabled.
| <column name="string_value"/> | ||
| <column name="enabled" valueBoolean="false"/> | ||
| <column name="is_trap_door" valueBoolean="false"/> | ||
| <column name="description" value="Number of previous passwords to check when a user changes their password. Set to 0 or disable to allow password reuse."/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set to 0 or disable to allow password reuse. i dont like this. If it is enabled, it should prevent password reusage! Having it enabled and value = 0 should not "allow password reuse" but instead do not allow any reused password!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely agree! I've updated the description to: "When enabled, prevents password reuse. The value specifies how many previous passwords to check (e.g., 3 = last 3 passwords). Set to 0 to check ALL previous passwords. Disable this setting to allow password reuse. This makes it clear that enabling with 0 is the strictest setting, not the most permissive.
adamsaghy
left a comment
There was a problem hiding this 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!
814bb25 to
552c5f4
Compare
Addressed all the concerns. Also following pre commits(./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest) |
adamsaghy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add proper testing to ensure correct behaviour!
Description
Implements FINERACT-2005: Prohibit password re-use with a configurable global setting.
Changes
restrict-reuse-of-password(enabled by default, value=3)How It Works
PasswordPreviouslyUsedExceptionif match found.Related Issue
Resolves FINERACT-2005