feat: same origin header & password max length to prevent clickjackingg & DoS (#2370)

Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
This commit is contained in:
Shubham Palriwala
2024-04-04 17:17:53 +05:30
committed by GitHub
parent 8d675bb91c
commit 3a8aced70d
2 changed files with 11 additions and 2 deletions

View File

@@ -13,7 +13,7 @@ const PASSWORD_REGEX = {
const DEFAULT_VALIDATIONS = [
{ label: "Mix of uppercase and lowercase", state: false },
{ label: "Minimum 8 characters long", state: false },
{ label: "Minimum 8 & Maximum 128 characters long", state: false },
{ label: "Contain at least 1 number", state: false },
];
@@ -30,7 +30,7 @@ export default function IsPasswordValid({
let newValidations = [...DEFAULT_VALIDATIONS];
if (password !== null) {
newValidations = checkValidation(newValidations, 0, PASSWORD_REGEX.UPPER_AND_LOWER.test(password));
newValidations = checkValidation(newValidations, 1, password.length >= 8);
newValidations = checkValidation(newValidations, 1, password.length >= 8 && password.length <= 128);
newValidations = checkValidation(newValidations, 2, PASSWORD_REGEX.NUMBER.test(password));
}
setIsValid(newValidations.every((validation) => validation.state === true));

View File

@@ -111,6 +111,15 @@ const nextConfig = {
},
],
},
{
source: "/(.*)",
headers: [
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
],
},
];
},
env: {