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
Daniel1da6104f3873
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 e8afdf3fd3..8cb1578146 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@@ -29,7 +29,7 @@ export const constraintSchema = z(c) => {if (c.type !== ConstraintType.NoValueReuse) return true;const num = Number(c.value);- return !Number.isNaN(num) && num >= 1 && num <= MAX_NO_REUSE_VERSIONS;+ return Number.isInteger(num) && num >= 1 && num <= MAX_NO_REUSE_VERSIONS;},{message: `No value reuse version count must be between 1 and ${MAX_NO_REUSE_VERSIONS}`,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 50a78525d5..32360502b0 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@@ -1,4 +1,5 @@import { ForbiddenError } from "@casl/ability";+import picomatch from "picomatch";import { ActionProjectType } from "@app/db/schemas";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";@@ -359,8 +360,14 @@ 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;- const hasNoValueReuseConstraint = parsedRules.some((r) =>+ 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) =>r.inputs.constraints?.some((c) => c.type === ConstraintType.NoValueReuse && c.appliesTo === ConstraintTarget.SecretValue)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 2931dd482f..6975ec2a12 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@@ -120,7 +120,7 @@ export const constraintSchema = z(c) => {if (c.type !== ConstraintType.NoValueReuse) return true;const num = Number(c.value);- return !Number.isNaN(num) && num >= 1 && num <= MAX_NO_REUSE_VERSIONS;+ return Number.isInteger(num) && num >= 1 && num <= MAX_NO_REUSE_VERSIONS;},{message: `Must be a number between 1 and ${MAX_NO_REUSE_VERSIONS}`,