Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
requested changes
Danielb74e138644d0
diff --git a/backend/src/services/secret-validation-rule/secret-validation-rule-fns.ts b/backend/src/services/secret-validation-rule/secret-validation-rule-fns.tsindex 3323ab2581..9a88752a87 100644--- a/backend/src/services/secret-validation-rule/secret-validation-rule-fns.ts+++ b/backend/src/services/secret-validation-rule/secret-validation-rule-fns.ts@@ -170,7 +170,7 @@ const CONSTRAINT_LABELS: Record<ConstraintType, string> = {[ConstraintType.RegexPattern]: "Regex pattern",[ConstraintType.RequiredPrefix]: "Required prefix",[ConstraintType.RequiredSuffix]: "Required suffix",- [ConstraintType.NoValueReuse]: "No reuse of previous values"+ [ConstraintType.PreventValueReuse]: "Prevent reuse of previous secret values"};const TARGET_LABELS: Record<ConstraintTarget, string> = {@@ -236,7 +236,7 @@ const evaluateConstraint = (constraint: TConstraint, secret: TSecretToValidate):}return null;}- case ConstraintType.NoValueReuse: {+ case ConstraintType.PreventValueReuse: {if (secret.value === undefined || !secret.previousValues?.length) {return null;}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.tsindex 8cb1578146..99fa299aeb 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@@ -9,7 +9,7 @@ import {TSecretValidationRuleInputs} from "./secret-validation-rule-types";-const MAX_NO_REUSE_VERSIONS = 100;+export const MAX_PREVENT_VALUE_REUSE_VERSIONS = 100;export const constraintSchema = z.object({@@ -17,22 +17,22 @@ export const constraintSchema = zappliesTo: z.nativeEnum(ConstraintTarget),value: z.string()})- .refine((c) => c.type === ConstraintType.NoValueReuse || c.value.length > 0, {+ .refine((c) => c.type === ConstraintType.PreventValueReuse || c.value.length > 0, {message: "Value is required",path: ["value"]})- .refine((c) => c.type !== ConstraintType.NoValueReuse || c.appliesTo === ConstraintTarget.SecretValue, {+ .refine((c) => c.type !== ConstraintType.PreventValueReuse || c.appliesTo === ConstraintTarget.SecretValue, {message: "No value reuse constraint can only apply to secret values",path: ["appliesTo"]}).refine((c) => {- if (c.type !== ConstraintType.NoValueReuse) return true;+ if (c.type !== ConstraintType.PreventValueReuse) return true;const num = Number(c.value);- return Number.isInteger(num) && num >= 1 && num <= MAX_NO_REUSE_VERSIONS;+ return Number.isInteger(num) && num >= 1 && num <= MAX_PREVENT_VALUE_REUSE_VERSIONS;},{- message: `No value reuse version count must be between 1 and ${MAX_NO_REUSE_VERSIONS}`,+ message: `Prevent value reuse version count must be between 1 and ${MAX_PREVENT_VALUE_REUSE_VERSIONS}`,path: ["value"]});diff --git a/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts b/backend/src/services/secret-validation-rule/secret-validation-rule-service.tsindex 32360502b0..b7ccc1e8d3 100644--- a/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts+++ b/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts@@ -15,7 +15,7 @@ import { TSecretV2BridgeDALFactory } from "../secret-v2-bridge/secret-v2-bridge-import { TSecretVersionV2DALFactory } from "../secret-v2-bridge/secret-version-dal";import { TSecretValidationRuleDALFactory } from "./secret-validation-rule-dal";import { checkForOverlappingRules, enforceSecretValidationRules } from "./secret-validation-rule-fns";-import { parseSecretValidationRuleInputs } from "./secret-validation-rule-schemas";+import { MAX_PREVENT_VALUE_REUSE_VERSIONS, parseSecretValidationRuleInputs } from "./secret-validation-rule-schemas";import {ConstraintTarget,ConstraintType,@@ -360,28 +360,27 @@ export const secretValidationRuleServiceFactory = ({)}));- // filter to rules that actually match this environment + path so we don't trigger expensive version-history lookups for unrelated NoValueReuse rules.- const MAX_NO_REUSE_VERSIONS = 100;+ // filter to rules that actually match this environment + path so we don't trigger expensive version-history lookups for unrelated PreventValueReuse rules.const matchingRules = parsedRules.filter((r) => {if (r.envId && r.envId !== envId) return false;return picomatch.isMatch(secretPath, r.secretPath, { strictSlashes: false });});- const hasNoValueReuseConstraint = matchingRules.some((r) =>+ const hasPreventValueReuseConstraint = matchingRules.some((r) =>r.inputs.constraints?.some(- (c) => c.type === ConstraintType.NoValueReuse && c.appliesTo === ConstraintTarget.SecretValue+ (c) => c.type === ConstraintType.PreventValueReuse && c.appliesTo === ConstraintTarget.SecretValue));const previousValuesMap: Record<string, string[]> = {};- if (hasNoValueReuseConstraint) {+ if (hasPreventValueReuseConstraint) {const secretIdsToCheck = secrets.filter((s) => s.secretId).map((s) => s.secretId!);if (secretIdsToCheck.length) {const allVersions = await Promise.all(secretIdsToCheck.map((sId) =>secretVersionV2BridgeDAL.find({ secretId: sId },- { sort: [["version", "desc"]], limit: MAX_NO_REUSE_VERSIONS }+ { sort: [["version", "desc"]], limit: MAX_PREVENT_VALUE_REUSE_VERSIONS })));diff --git a/backend/src/services/secret-validation-rule/secret-validation-rule-types.ts b/backend/src/services/secret-validation-rule/secret-validation-rule-types.tsindex 0f5c6b3995..c41e30b544 100644--- a/backend/src/services/secret-validation-rule/secret-validation-rule-types.ts+++ b/backend/src/services/secret-validation-rule/secret-validation-rule-types.ts@@ -10,7 +10,7 @@ export enum ConstraintType {RegexPattern = "regex-pattern",RequiredPrefix = "required-prefix",RequiredSuffix = "required-suffix",- NoValueReuse = "no-value-reuse"+ PreventValueReuse = "prevent-value-reuse"}export enum ConstraintTarget {diff --git a/frontend/src/components/v3/generic/PasswordGenerator/PasswordGenerator.tsx b/frontend/src/components/v3/generic/PasswordGenerator/PasswordGenerator.tsxindex e5cfb5f28d..755705ab14 100644--- a/frontend/src/components/v3/generic/PasswordGenerator/PasswordGenerator.tsx+++ b/frontend/src/components/v3/generic/PasswordGenerator/PasswordGenerator.tsx@@ -128,7 +128,7 @@ const CONSTRAINT_LABELS: Record<ConstraintType, string> = {[ConstraintType.RegexPattern]: "Pattern",[ConstraintType.MinLength]: "Min length",[ConstraintType.MaxLength]: "Max length",- [ConstraintType.NoValueReuse]: "No reuse of previous values"+ [ConstraintType.PreventValueReuse]: "Prevent reuse of previous values"};const RuleOptionComponent = ({ isSelected, children, ...props }: OptionProps<RuleOption>) => (@@ -379,12 +379,12 @@ export const PasswordGenerator = ({<spanclassName={twMerge("font-medium text-muted",- constraint.type === ConstraintType.NoValueReuse && "text-label"+ constraint.type === ConstraintType.PreventValueReuse && "text-label")}>{CONSTRAINT_LABELS[constraint.type]}</span>- {constraint.type !== ConstraintType.NoValueReuse && (+ {constraint.type !== ConstraintType.PreventValueReuse && (<>: <span className="font-mono text-label">{constraint.value}</span></>diff --git a/frontend/src/hooks/api/secretValidationRules/types.ts b/frontend/src/hooks/api/secretValidationRules/types.tsindex bcd4c8abac..ebcc0bbca9 100644--- a/frontend/src/hooks/api/secretValidationRules/types.ts+++ b/frontend/src/hooks/api/secretValidationRules/types.ts@@ -8,7 +8,7 @@ export enum ConstraintType {RegexPattern = "regex-pattern",RequiredPrefix = "required-prefix",RequiredSuffix = "required-suffix",- NoValueReuse = "no-value-reuse"+ PreventValueReuse = "prevent-value-reuse"}export enum ConstraintTarget {diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/ConstraintCard.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/ConstraintCard.tsxindex ae3e7967be..26ce6088c0 100644--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/ConstraintCard.tsx+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/ConstraintCard.tsx@@ -45,11 +45,11 @@ export const ConstraintCard = ({ index, onRemove }: Props) => {const Icon = constraintOption?.icon;const placeholder = constraintOption?.placeholder;- const isNoValueReuse = constraintType === ConstraintType.NoValueReuse;+ const isPreventValueReuse = constraintType === ConstraintType.PreventValueReuse;const isNumericInput =constraintType === ConstraintType.MinLength ||constraintType === ConstraintType.MaxLength ||- constraintType === ConstraintType.NoValueReuse;+ constraintType === ConstraintType.PreventValueReuse;return (<div className="rounded-md border border-border bg-card p-4">@@ -70,7 +70,7 @@ export const ConstraintCard = ({ index, onRemove }: Props) => {)}<div className="mt-3 grid grid-cols-2 gap-3">- {isNoValueReuse ? (+ {isPreventValueReuse ? (<div className="flex flex-col gap-1"><label className="text-xs font-medium text-muted">Applies to</label><Input value="Secret Value" readOnly className="cursor-default opacity-60" />@@ -109,15 +109,15 @@ export const ConstraintCard = ({ index, onRemove }: Props) => {<label className="text-xs font-medium text-muted"><div className="flex items-center gap-1">{CONSTRAINT_VALUE_LABELS[constraintType]}- {constraintType === ConstraintType.NoValueReuse && (+ {constraintType === ConstraintType.PreventValueReuse && (<Tooltip><TooltipTrigger asChild><InfoIcon className="ml-1 size-3.5 text-muted" /></TooltipTrigger><TooltipContent side="left" align="start" className="max-w-xs"><p className="text-sm">- When a secret is updated, its new value is compared against this many of its- most recent versions.+ When a secret is updated, its new value is validated against the specified+ number of prior versions.</p><p className="mt-2 text-xs text-muted">Maximum: 100 versions</p></TooltipContent>@@ -133,8 +133,8 @@ export const ConstraintCard = ({ index, onRemove }: Props) => {<Input{...field}type={isNumericInput ? "number" : "text"}- min={isNoValueReuse ? 1 : undefined}- max={isNoValueReuse ? 100 : undefined}+ min={isPreventValueReuse ? 1 : undefined}+ max={isPreventValueReuse ? 100 : undefined}placeholder={placeholder?.toString() || undefined}isError={Boolean(error)}/>diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.tsxindex d0b8593f75..691ce71b7c 100644--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.tsx+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.tsx@@ -285,7 +285,7 @@ const RuleFormContent = ({type: opt.type,appliesTo: defaultTarget,value:- opt.type === ConstraintType.NoValueReuse+ opt.type === ConstraintType.PreventValueReuse? String(opt.placeholder || 10): ""})diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.utils.ts b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.utils.tsindex 6975ec2a12..607d408ea1 100644--- a/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.utils.ts+++ b/frontend/src/pages/secret-manager/SettingsPage/components/SecretValidationRulesTab/SecretValidationRulesTab.utils.ts@@ -14,7 +14,7 @@ export enum ConstraintType {RegexPattern = "regex-pattern",RequiredPrefix = "required-prefix",RequiredSuffix = "required-suffix",- NoValueReuse = "no-value-reuse"+ PreventValueReuse = "prevent-value-reuse"}export enum ConstraintTarget {@@ -67,11 +67,11 @@ export const CONSTRAINT_OPTIONS: {icon: TextIcon},{- type: ConstraintType.NoValueReuse,- label: "No Value Reuse",+ type: ConstraintType.PreventValueReuse,+ label: "Prevent Value Reuse",description: "Prevent reusing previous secret values",cardDescription:- "Prevents secrets from reusing previous values. When a secret is updated, its new value must differ from its most recent versions.",+ "When a secret is updated, its new value is validated against the specified number of prior versions.",placeholder: 10,icon: HistoryIcon,allowedTargets: [ConstraintTarget.SecretValue]@@ -84,7 +84,7 @@ export const CONSTRAINT_VALUE_LABELS: Record<ConstraintType, string> = {[ConstraintType.RegexPattern]: "Pattern",[ConstraintType.RequiredPrefix]: "Text",[ConstraintType.RequiredSuffix]: "Text",- [ConstraintType.NoValueReuse]: "Previous versions"+ [ConstraintType.PreventValueReuse]: "Previous versions"};export const CONSTRAINT_TYPE_LABELS: Record<ConstraintType, string> = {@@ -93,7 +93,7 @@ export const CONSTRAINT_TYPE_LABELS: Record<ConstraintType, string> = {[ConstraintType.RegexPattern]: "Regex Pattern",[ConstraintType.RequiredPrefix]: "Required Prefix",[ConstraintType.RequiredSuffix]: "Required Suffix",- [ConstraintType.NoValueReuse]: "No Value Reuse"+ [ConstraintType.PreventValueReuse]: "Prevent Value Reuse"};export enum RuleType {@@ -112,13 +112,13 @@ export const constraintSchema = zappliesTo: z.nativeEnum(ConstraintTarget),value: z.string()})- .refine((c) => c.type === ConstraintType.NoValueReuse || c.value.length > 0, {+ .refine((c) => c.type === ConstraintType.PreventValueReuse || c.value.length > 0, {message: "Value is required",path: ["value"]}).refine((c) => {- if (c.type !== ConstraintType.NoValueReuse) return true;+ if (c.type !== ConstraintType.PreventValueReuse) return true;const num = Number(c.value);return Number.isInteger(num) && num >= 1 && num <= MAX_NO_REUSE_VERSIONS;},