Skip to content

Commit

Permalink
AUT-2164: Add feature switch
Browse files Browse the repository at this point in the history
  • Loading branch information
LazarAlexandru-Constantin committed May 20, 2024
1 parent 06a1f19 commit dc0c4f5
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions ci/terraform/authdev1.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gtm_id = ""
support_account_recovery = "1"
support_authorize_controller = "1"
support_2fa_b4_password_reset = "1"
support_check_email_fraud = "1"
language_toggle_enabled = "1"

frontend_task_definition_cpu = 512
Expand Down
1 change: 1 addition & 0 deletions ci/terraform/authdev2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gtm_id = ""
support_account_recovery = "1"
support_authorize_controller = "1"
support_2fa_b4_password_reset = "1"
support_check_email_fraud = "1"
language_toggle_enabled = "1"

frontend_task_definition_cpu = 512
Expand Down
1 change: 1 addition & 0 deletions ci/terraform/build.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ support_account_interventions = "1"
support_reauthentication = "1"
support_2fa_b4_password_reset = "1"
support_2hr_lockout = "1"
support_check_email_fraud = "1"
password_reset_code_entered_wrong_blocked_minutes = "1"
account_recovery_code_entered_wrong_blocked_minutes = "1"
code_request_blocked_minutes = "1"
Expand Down
1 change: 1 addition & 0 deletions ci/terraform/dev.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ support_account_interventions = "1"
support_reauthentication = "1"
support_2fa_b4_password_reset = "1"
support_2hr_lockout = "1"
support_check_email_fraud = "1"
password_reset_code_entered_wrong_blocked_minutes = "1"
account_recovery_code_entered_wrong_blocked_minutes = "1"
code_request_blocked_minutes = "1"
Expand Down
4 changes: 4 additions & 0 deletions ci/terraform/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ locals {
name = "SUPPORT_2HR_LOCKOUT"
value = var.support_2hr_lockout
},
{
name = "SUPPORT_CHECK_EMAIL_FRAUD"
value = var.support_check_email_fraud
},
{
name = "LANGUAGE_TOGGLE_ENABLED"
value = var.language_toggle_enabled
Expand Down
1 change: 1 addition & 0 deletions ci/terraform/integration.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ support_account_interventions = "1"
support_authorize_controller = "1"
support_2fa_b4_password_reset = "1"
support_2hr_lockout = "1"
support_check_email_fraud = "0"
code_request_blocked_minutes = "120"
account_recovery_code_entered_wrong_blocked_minutes = "120"
code_entered_wrong_blocked_minutes = "120"
Expand Down
1 change: 1 addition & 0 deletions ci/terraform/production.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ support_account_interventions = "1"
support_authorize_controller = "1"
support_2fa_b4_password_reset = "1"
support_2hr_lockout = "1"
support_check_email_fraud = "0"
code_request_blocked_minutes = "120"
account_recovery_code_entered_wrong_blocked_minutes = "120"
code_entered_wrong_blocked_minutes = "120"
Expand Down
1 change: 1 addition & 0 deletions ci/terraform/staging.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ support_account_interventions = "1"
support_authorize_controller = "1"
support_2fa_b4_password_reset = "1"
support_2hr_lockout = "1"
support_check_email_fraud = "1"
code_request_blocked_minutes = "120"
account_recovery_code_entered_wrong_blocked_minutes = "120"
code_entered_wrong_blocked_minutes = "120"
Expand Down
7 changes: 6 additions & 1 deletion ci/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ variable "support_reauthentication" {
default = "0"
}

variable "support_check_email_fraud" {
description = "When true enables Fraudulent email checking via Experian lockout"
type = string
default = "0"
}

variable "email_entered_wrong_blocked_minutes" {
description = "The duration, in minutes, for which a user is blocked after entering the wrong email multiple times during reauthentication"
default = "15"
Expand Down Expand Up @@ -342,4 +348,3 @@ variable "language_toggle_enabled" {
description = "Enables English / Welsh language toggle in the user interface"
}


1 change: 1 addition & 0 deletions scripts/_create_env_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class EnvFileSection(TypedDict):
"SUPPORT_2FA_B4_PASSWORD_RESET": 1,
"SUPPORT_REAUTHENTICATION": 1,
"SUPPORT_2HR_LOCKOUT": 1,
"SUPPORT_CHECK_EMAIL_FRAUD": 1,
},
},
{
Expand Down
12 changes: 12 additions & 0 deletions src/components/enter-email/enter-email-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { checkReauthUsersService } from "../check-reauth-users/check-reauth-user
import {
getEmailEnteredWrongBlockDurationInMinutes,
support2hrLockout,
supportCheckEmailFraud,
supportReauthentication,
} from "../../config";
import {
Expand Down Expand Up @@ -126,6 +127,17 @@ export function enterEmailPost(
result.data.lockoutInformation.length > 0
)
setUpAuthAppLocks(req, result.data.lockoutInformation);
if (supportCheckEmailFraud()) {
const checkEmailFraudResponse =
await checkEmailFraudService.checkEmailFraudBlock(
email,
sessionId,
req.ip,
clientSessionId,
persistentSessionId
);
logger.info(`checkEmailFraudResponse: ${checkEmailFraudResponse.data}`);
}
req.session.user.enterEmailMfaType = result.data.mfaMethodType;
req.session.user.redactedPhoneNumber = result.data.phoneNumberLastThree;
const nextState = result.data.doesUserExist
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ export function supportReauthentication(): boolean {
return process.env.SUPPORT_REAUTHENTICATION === "1";
}

export function supportCheckEmailFraud(): boolean {
return process.env.SUPPORT_CHECK_EMAIL_FRAUD === "1";
}

export function getLanguageToggleEnabled(): boolean {
return process.env.LANGUAGE_TOGGLE_ENABLED === "1";
}
Expand Down

0 comments on commit dc0c4f5

Please sign in to comment.