Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge remote-tracking branch 'origin/main' into matheus/password-validation-rules

Matheus Nogueirac2d1ad7f590b
diff --cc frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx
index 052299277f,4b2374377d..32c5e543e6
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/LdapPasswordRotationParametersFields.tsx
@@@ -1,16 -1,23 +1,28 @@@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
- import { DEFAULT_PASSWORD_REQUIREMENTS } from "@app/components/secret-rotations-v2/forms/schemas/shared";
+ import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { ValidationRuleOverrideNotice } from "@app/components/secret-validation/ValidationRuleOverrideNotice";
- import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
+ import {
+ Field,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+ } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/types/ldap-password-rotation";
+import {
+ SecretRotationRuleProvider,
+ SecretValidationRuleType
+} from "@app/hooks/api/secretValidationRules";
+ import { PasswordRequirementsFields } from "./shared";
+
export const LdapPasswordRotationParametersFields = () => {
const { control, watch, setValue } = useFormContext<
TSecretRotationV2Form & {
@@@ -133,145 -161,7 +168,13 @@@
/>
)}
</div>
- <div className="flex flex-col gap-3">
- <ValidationRuleOverrideNotice
- type={SecretValidationRuleType.SecretRotations}
- provider={SecretRotationRuleProvider.LdapPassword}
- environmentSlug={environmentSlug}
- secretPath={secretPath}
- />
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
++ <ValidationRuleOverrideNotice
++ type={SecretValidationRuleType.SecretRotations}
++ provider={SecretRotationRuleProvider.LdapPassword}
++ environmentSlug={environmentSlug}
++ secretPath={secretPath}
++ />
+ <PasswordRequirementsFields />
</>
);
};
diff --cc frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx
index 0c1b5dcf4d,15746699ba..9a7dccce37
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/UnixLinuxLocalAccountRotationParametersFields.tsx
@@@ -1,16 -1,25 +1,30 @@@
import { Controller, useFormContext } from "react-hook-form";
import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
- import { DEFAULT_PASSWORD_REQUIREMENTS } from "@app/components/secret-rotations-v2/forms/schemas/shared";
+ import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";
+import { ValidationRuleOverrideNotice } from "@app/components/secret-validation/ValidationRuleOverrideNotice";
- import { Checkbox, FormControl, Input, Select, SelectItem } from "@app/components/v2";
+ import {
+ Checkbox,
+ Field,
+ FieldContent,
+ FieldError,
+ FieldFeedback,
+ Input,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue
+ } from "@app/components/v3";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { UnixLinuxLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/unix-linux-local-account-rotation";
+import {
+ SecretRotationRuleProvider,
+ SecretValidationRuleType
+} from "@app/hooks/api/secretValidationRules";
+ import { PasswordRequirementsFields } from "./shared";
+
export const UnixLinuxLocalAccountRotationParametersFields = () => {
const { control, watch, setValue } = useFormContext<
TSecretRotationV2Form & {
@@@ -157,145 -192,7 +199,13 @@@
/>
)}
</div>
- <div className="flex flex-col gap-3">
- <ValidationRuleOverrideNotice
- type={SecretValidationRuleType.SecretRotations}
- provider={SecretRotationRuleProvider.UnixLinuxLocalAccount}
- environmentSlug={environmentSlug}
- secretPath={secretPath}
- />
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.length}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
++ <ValidationRuleOverrideNotice
++ type={SecretValidationRuleType.SecretRotations}
++ provider={SecretRotationRuleProvider.UnixLinuxLocalAccount}
++ environmentSlug={environmentSlug}
++ secretPath={secretPath}
++ />
+ <PasswordRequirementsFields />
</>
);
};
diff --cc frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx
index 54b83d1c77,d90926fe32..49e82e604b
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/SqlCredentialsRotationParametersFields.tsx
@@@ -139,168 -113,42 +114,42 @@@ export const SqlCredentialsRotationPara
name="parameters.rotationStatement"
defaultValue={rotationOption?.template?.rotationStatement}
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Rotation Statement"
- isError={Boolean(error?.message)}
- errorText={error?.message}
- helperText="username, password and database are dynamically provisioned"
- >
+ <Field data-invalid={Boolean(error)}>
+ <FieldLabelWithTooltip>Rotation Statement</FieldLabelWithTooltip>
<TextArea
{...field}
- reSize="none"
+ className="resize-none text-sm"
rows={3}
- className="border-mineshaft-600 bg-mineshaft-900 text-sm"
+ isError={Boolean(error)}
+ aria-describedby="sql-rotation-statement-feedback"
/>
- </FormControl>
+ <FieldFeedback
+ id="sql-rotation-statement-feedback"
+ description="username, password and database are dynamically provisioned"
+ error={error?.message}
+ />
+ </Field>
)}
/>
- <div className="flex flex-col gap-3">
- {SECRET_ROTATION_TO_RULE_PROVIDER[type] && (
- <ValidationRuleOverrideNotice
- type={SecretValidationRuleType.SecretRotations}
- provider={SECRET_ROTATION_TO_RULE_PROVIDER[type]}
- environmentSlug={environmentSlug}
- secretPath={secretPath}
- />
- )}
- <div className="w-full border-b border-mineshaft-600">
- <span className="text-sm text-mineshaft-300">Password Requirements</span>
- </div>
- <div className="grid grid-cols-2 gap-x-3 gap-y-1 rounded-sm border border-mineshaft-600 bg-mineshaft-700 px-3 pt-3">
- <Controller
- control={control}
- name="parameters.passwordRequirements.length"
- defaultValue={
- // for oracle 48 would throw error
- type === SecretRotation.OracleDBCredentials
- ? 30
- : DEFAULT_PASSWORD_REQUIREMENTS.length
- }
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Password Length"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="The length of the password to generate"
- >
- <Input
- type="number"
- min={1}
- max={250}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.digits"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.digits}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Digit Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of digits"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.lowercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.lowercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Lowercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of lowercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.uppercase"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.uppercase}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Uppercase Character Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of uppercase characters"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.required.symbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.required.symbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Symbol Count"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Minimum number of symbols"
- >
- <Input
- type="number"
- min={0}
- size="sm"
- {...field}
- onChange={(e) => field.onChange(Number(e.target.value))}
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="parameters.passwordRequirements.allowedSymbols"
- defaultValue={DEFAULT_PASSWORD_REQUIREMENTS.allowedSymbols}
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Symbols"
- isError={Boolean(error)}
- errorText={error?.message}
- tooltipText="Symbols to use in generated password"
- >
- <Input
- placeholder="-_.~!*"
- size="sm"
- {...field}
- onChange={(e) => field.onChange(e.target.value)}
- />
- </FormControl>
- )}
- />
- </div>
- </div>
- </TabPanel>
- {type === SecretRotation.PostgresCredentials && (
++ {SECRET_ROTATION_TO_RULE_PROVIDER[type] && (
+ <ValidationRuleOverrideNotice
+ type={SecretValidationRuleType.SecretRotations}
- provider={SecretRotationRuleProvider.PostgresCredentials}
++ provider={SECRET_ROTATION_TO_RULE_PROVIDER[type]}
+ environmentSlug={environmentSlug}
+ secretPath={secretPath}
+ />
+ )}
+ <PasswordRequirementsFields
+ defaultRequirements={{
+ ...DEFAULT_PASSWORD_REQUIREMENTS,
+ // Oracle limits generated passwords to 30 characters.
+ length:
+ type === SecretRotation.OracleDBCredentials
+ ? 30
+ : DEFAULT_PASSWORD_REQUIREMENTS.length
+ }}
+ />
+ </TabsContent>
</Tabs>
);
};
diff --cc frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx
index ddf01cc36f,e6d324184a..dd251fc8d9
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.tsx
@@@ -208,27 -208,6 +208,25 @@@ const RuleFormContent = (
);
return Boolean(hasRegex && hasLength);
})();
+
+ // Oracle 12c and older limits passwords to 30 characters. Show a heads-up
+ // when OracleDB is selected and a constraint actually exceeds that limit:
+ // min/max length > 30, or any regex (whose output length can't be checked
+ // statically).
+ const ORACLE_12C_MAX_PASSWORD_LENGTH = 30;
+ const watchedEnforcement = form.watch("enforcement");
+ const showOracleLengthWarning = (() => {
+ if (watchedEnforcement.type !== RuleType.SecretRotations) return false;
- if (
- !watchedEnforcement.inputs.providers.includes(SecretRotationRuleProvider.OracleDBCredentials)
- )
++ if (!watchedEnforcement.providers.includes(SecretRotationRuleProvider.OracleDBCredentials))
+ return false;
+ return watchedConstraints?.some((c) => {
+ if (c.type === ConstraintType.RegexPattern) return true;
+ if (c.type === ConstraintType.MinLength || c.type === ConstraintType.MaxLength) {
+ return Number(c.value) > ORACLE_12C_MAX_PASSWORD_LENGTH;
+ }
+ return false;
+ });
+ })();
const availableConstraintOptions = CONSTRAINT_OPTIONS.filter((opt) => {
if (disallowedConstraintTypes.includes(opt.type)) return false;
const targets = isGeneratedCredentialRule