diff --git a/backend/src/ee/services/secret-rotation-v2/shared/general/password-requirements-schema.ts b/backend/src/ee/services/secret-rotation-v2/shared/general/password-requirements-schema.ts index 74d8ddf40..5d575239d 100644 --- a/backend/src/ee/services/secret-rotation-v2/shared/general/password-requirements-schema.ts +++ b/backend/src/ee/services/secret-rotation-v2/shared/general/password-requirements-schema.ts @@ -1,3 +1,4 @@ +import RE2 from "re2"; import { z } from "zod"; import { SecretRotations } from "@app/lib/api-docs"; @@ -29,6 +30,7 @@ export const PasswordRequirementsSchema = z }), allowedSymbols: z .string() + .regex(new RE2("[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?~]"), "Invalid symbols") .optional() .describe(SecretRotations.PARAMETERS.GENERAL.PASSWORD_REQUIREMENTS.allowedSymbols) }) diff --git a/backend/src/services/app-connection/ldap/ldap-connection-schemas.ts b/backend/src/services/app-connection/ldap/ldap-connection-schemas.ts index 3943fa2ff..189a7490a 100644 --- a/backend/src/services/app-connection/ldap/ldap-connection-schemas.ts +++ b/backend/src/services/app-connection/ldap/ldap-connection-schemas.ts @@ -1,3 +1,4 @@ +import RE2 from "re2"; import { z } from "zod"; import { AppConnections } from "@app/lib/api-docs"; @@ -16,7 +17,7 @@ export const LdapConnectionSimpleBindCredentialsSchema = z.object({ .string() .trim() .min(1, "URL required") - .refine((value) => value.startsWith("ldap://") || value.startsWith("ldaps://")) + .regex(new RE2(/^ldaps?:\/\//)) .describe(AppConnections.CREDENTIALS.LDAP.url), dn: z.string().trim().min(1, "Distinguished Name (DN) required").describe(AppConnections.CREDENTIALS.LDAP.dn), password: z.string().trim().min(1, "Password required").describe(AppConnections.CREDENTIALS.LDAP.password), diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/shared/password-requirements-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/shared/password-requirements-schema.ts index 05b673ab6..a02852ec8 100644 --- a/frontend/src/components/secret-rotations-v2/forms/schemas/shared/password-requirements-schema.ts +++ b/frontend/src/components/secret-rotations-v2/forms/schemas/shared/password-requirements-schema.ts @@ -14,6 +14,7 @@ export const PasswordRequirementsSchema = z }), allowedSymbols: z .string() + .regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?~]/, "Invalid symbols") .optional() .transform((value) => value || "-_.~!*") })