Skip to content

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

requested changes

Daniele51568e69f22
diff --git a/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts b/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts
index be1b6ebb0c..79411a8246 100644
--- a/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts
+++ b/backend/src/services/secret-validation-rule/secret-validation-rule-schemas.ts
@@ -19,9 +19,13 @@ export const MAX_PREVENT_VALUE_REUSE_VERSIONS = 25;
const STATIC_RULE_TARGETS = new Set<ConstraintTarget>([ConstraintTarget.SecretKey, ConstraintTarget.SecretValue]);
const GENERATED_RULE_TARGETS = new Set<ConstraintTarget>([ConstraintTarget.GeneratedPassword]);
-// Constraint types not meaningful for the given rule type. PreventValueReuse
-// requires a version history, which dynamic secrets (ephemeral leases) do not have.
-const DYNAMIC_DISALLOWED_CONSTRAINTS = new Set<ConstraintType>([ConstraintType.PreventValueReuse]);
+// Constraint types disallowed on generated-credential rules (dynamic secrets
+// and secret rotations). PreventValueReuse is intentionally static-secret-only:
+// for dynamic secrets it has no anchor (each lease is independent and ephemeral),
+// and for rotations we explicitly want users to drive uniqueness through
+// password generation (length/regex) rather than a reuse check that would
+// surface a rotation as a failed lease at issue time.
+const GENERATED_RULE_DISALLOWED_CONSTRAINTS = new Set<ConstraintType>([ConstraintType.PreventValueReuse]);
const baseConstraintSchema = z.object({
type: z.nativeEnum(ConstraintType),
@@ -56,7 +60,9 @@ const buildConstraintSchemaForRuleType = (ruleType: SecretValidationRuleType) =>
const allowedTargets =
ruleType === SecretValidationRuleType.StaticSecrets ? STATIC_RULE_TARGETS : GENERATED_RULE_TARGETS;
const disallowedTypes =
- ruleType === SecretValidationRuleType.StaticSecrets ? new Set<ConstraintType>() : DYNAMIC_DISALLOWED_CONSTRAINTS;
+ ruleType === SecretValidationRuleType.StaticSecrets
+ ? new Set<ConstraintType>()
+ : GENERATED_RULE_DISALLOWED_CONSTRAINTS;
return baseConstraintSchema
.refine((c) => allowedTargets.has(c.appliesTo), {
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.utils.ts b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.utils.ts
index 3245fcbb26..75ab4ba434 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.utils.ts
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesSection/SecretValidationRulesSection.utils.ts
@@ -143,9 +143,11 @@ export const SECRET_ROTATION_PROVIDER_OPTIONS: TProviderOption<SecretRotationRul
}
];
-// Constraints supported for generated-credential rules. PreventValueReuse is
-// excluded for dynamic secrets (ephemeral leases, no version history) but
-// supported for rotations.
+// PreventValueReuse is intentionally static-secret-only. For dynamic secrets
+// each lease is independent so reuse has no meaning; for rotations we drive
+// uniqueness through password generation (length/regex) rather than failing a
+// rotation at issue time because the generator happened to land on a prior
+// value.
export const DYNAMIC_SECRET_RULE_DISALLOWED_CONSTRAINTS: ConstraintType[] = [
ConstraintType.PreventValueReuse
];