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
validation: add a maximum of 25 folders on creation
adilson6cd059894eff
diff --git a/backend/src/server/routes/v3/external-migration-router.ts b/backend/src/server/routes/v3/external-migration-router.tsindex 8e32a88e27..2e2ab93f86 100644--- a/backend/src/server/routes/v3/external-migration-router.ts+++ b/backend/src/server/routes/v3/external-migration-router.ts@@ -7,6 +7,7 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";import { getTelemetryDistinctId } from "@app/server/lib/telemetry";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { AuthMode } from "@app/services/auth/auth-type";+import { MAX_VAULT_IMPORT_PATHS } from "@app/services/external-migration/external-migration-fns/vault";import { ExternalMigrationProviders } from "@app/services/external-migration/external-migration-schemas";import {ExternalMigrationImportStatus,@@ -281,7 +282,13 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProvider.min(1).max(255).describe("The Vault KV secrets engine the selected paths belong to, e.g. 'kv' or 'apps/kv'."),- vaultSecretPaths: z.array(z.string().max(255)).min(1).max(100),+ vaultSecretPaths: z+ .array(z.string().max(255))+ .min(1, { message: "Select at least one Vault path to import." })+ .max(MAX_VAULT_IMPORT_PATHS, {+ message: `Select at most ${MAX_VAULT_IMPORT_PATHS} Vault paths per import. Import the remaining paths in another run.`+ })+ .describe(`The Vault secret paths to import, at most ${MAX_VAULT_IMPORT_PATHS} per request.`),connectionId: z.string().uuid(),keepVaultStructure: z.boolean()diff --git a/backend/src/services/external-migration/external-migration-fns/vault.ts b/backend/src/services/external-migration/external-migration-fns/vault.tsindex f52345c21e..8f516c6994 100644--- a/backend/src/services/external-migration/external-migration-fns/vault.ts+++ b/backend/src/services/external-migration/external-migration-fns/vault.ts@@ -610,6 +610,8 @@ export type TVaultFolderImportUnit = {secrets: { secretKey: string; secretValue: string }[];};+export const MAX_VAULT_IMPORT_PATHS = 25;+export const MAX_VAULT_FOLDER_IMPORT_SECRETS = 1024;export const assertVaultFolderImportSecretCount = (units: TVaultFolderImportUnit[]) => {diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsxindex 9d0ccdf822..9c28bd383b 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx@@ -67,6 +67,9 @@ type ContentProps = {const MAX_PATH_LENGTH = 30;+// keep in sync with MAX_VAULT_IMPORT_PATHS on the import endpoint+const MAX_IMPORT_PATHS = 25;+const getDisplayPath = (path: string) =>path.length > MAX_PATH_LENGTH ? `…${path.slice(path.length - MAX_PATH_LENGTH)}` : path;@@ -167,8 +170,16 @@ const Content = ({[selectedPaths, destinationPath, mountPath, keepVaultStructure]);const { invalidPaths } = preview;+ const isOverPathLimit = selectedPaths.length > MAX_IMPORT_PATHS;const handleImport = () => {+ if (isOverPathLimit) {+ createNotification({+ type: "error",+ text: `Select at most ${MAX_IMPORT_PATHS} Vault paths per import`+ });+ return;+ }if (!selectedPaths.length) {createNotification({type: "error",@@ -280,7 +291,8 @@ const Content = ({modal/><FieldDescription>- Choose one or more secret paths from the selected mount to import into Infisical+ Choose up to {MAX_IMPORT_PATHS} secret paths from the selected mount to import into+ Infisical</FieldDescription></Field>@@ -304,6 +316,21 @@ const Content = ({</FieldContent></Field>+ {isOverPathLimit && (+ <Alert variant="warning">+ <TriangleAlertIcon />+ <AlertTitle>+ {selectedPaths.length} secret paths selected, {MAX_IMPORT_PATHS} is the maximum+ </AlertTitle>+ <AlertDescription>+ An import handles at most {MAX_IMPORT_PATHS} Vault paths at a time. Deselect{" "}+ {selectedPaths.length - MAX_IMPORT_PATHS} path+ {selectedPaths.length - MAX_IMPORT_PATHS > 1 ? "s" : ""} and import the rest in+ another run.+ </AlertDescription>+ </Alert>+ )}+{invalidPaths.length > 0 && (<Alert variant="warning"><TriangleAlertIcon />@@ -401,6 +428,7 @@ const Content = ({onClick={handleImport}isDisabled={!selectedPaths.length ||+ isOverPathLimit ||invalidPaths.length > 0 ||mountsQuery.isLoading ||vaultSecretPathsQuery.isLoading