Skip to content

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

fix(secret-sync): remove the per-sync secret count cap

Calvin43b24b34707b
diff --git a/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts b/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts
index cadd58c755..297489b323 100644
--- a/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts
+++ b/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts
@@ -1,10 +1,8 @@
import {
- assertWithinSecretLimit,
buildSyncPayload,
getAncestorPaths,
getSyncedFolders,
- mergeImportedSecrets,
- SECRET_SYNC_MAX_SECRETS
+ mergeImportedSecrets
} from "./secret-sync-recursive-fns";
const deps = {
@@ -100,28 +98,6 @@ describe("getAncestorPaths", () => {
});
});
-describe("assertWithinSecretLimit", () => {
- test("accepts a count at the limit", () => {
- expect(() => assertWithinSecretLimit(SECRET_SYNC_MAX_SECRETS)).not.toThrow();
- });
-
- test("rejects a count above the limit with a message naming both numbers", () => {
- let error: unknown;
- try {
- assertWithinSecretLimit(SECRET_SYNC_MAX_SECRETS + 1);
- } catch (err) {
- error = err;
- }
-
- expect(error).toBeInstanceOf(Error);
- const { message } = error as Error;
- const overIndex = message.indexOf(String(SECRET_SYNC_MAX_SECRETS + 1));
- const limitIndex = message.indexOf(String(SECRET_SYNC_MAX_SECRETS), overIndex + 1);
- expect(overIndex).toBeGreaterThanOrEqual(0);
- expect(limitIndex).toBeGreaterThan(overIndex);
- });
-});
-
describe("mergeImportedSecrets", () => {
const imported = (key: string, secretValue: string) => ({ key, secretValue }) as never;
diff --git a/backend/src/services/secret-sync/secret-sync-recursive-fns.ts b/backend/src/services/secret-sync/secret-sync-recursive-fns.ts
index eb74957d7c..1ee8cbe0f3 100644
--- a/backend/src/services/secret-sync/secret-sync-recursive-fns.ts
+++ b/backend/src/services/secret-sync/secret-sync-recursive-fns.ts
@@ -33,22 +33,6 @@ export const getAncestorPaths = (path: string): string[] => {
return segments.map((_, index) => (index === 0 ? "/" : `/${segments.slice(0, index).join("/")}`));
};
-// buildSyncPayload expands secret references for every secret concurrently
-// (Promise.allSettled below), and expansion can hit the DB per secret, so this stays well under
-// what a 10-connection pool can take at once even with every slot serving one sync. Applies to
-// every sync, not just recursive ones: an oversized single folder is the same risk as an
-// oversized subtree. Raise further only once that concurrency is actually bounded.
-export const SECRET_SYNC_MAX_SECRETS = 500;
-
-export const assertWithinSecretLimit = (count: number) => {
- if (count <= SECRET_SYNC_MAX_SECRETS) return;
-
- throw new SecretSyncError({
- message: `This sync covers ${count} secrets, which is above the limit of ${SECRET_SYNC_MAX_SECRETS} for a single sync. Point the sync at a narrower secret path, or split it into several syncs.`,
- shouldRetry: false
- });
-};
-
export const getSyncedFolders = async ({
folderDAL,
projectEnvDAL,
@@ -164,8 +148,6 @@ export const buildSyncPayload = async (
? await secretV2BridgeDAL.findByFolderId({ folderId: folders[0].folderId })
: await secretV2BridgeDAL.findByFolderIds({ folderIds: folders.map(({ folderId }) => folderId) });
- assertWithinSecretLimit(secrets.length);
-
const entries: TSecretPayload[] = [];
await Promise.allSettled(
@@ -237,8 +219,6 @@ export const buildSyncPayload = async (
secrets: group.secrets
}))
);
-
- assertWithinSecretLimit(allEntries.length);
}
return createSecretSyncPayload(allEntries, { environment, keySchema });
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx
index 3369667858..e077ca410d 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncSourceFields.tsx
@@ -32,8 +32,6 @@ import {
import { AzureEntraIdScimSyncSourceFields } from "./AzureEntraIdScimSyncSourceFields";
import { TSecretSyncForm } from "./schemas";
-// Mirrors SECRET_SYNC_MAX_SECRETS in backend/src/services/secret-sync/secret-sync-recursive-fns.ts.
-const SECRET_SYNC_MAX_SECRETS = 100;
const MAX_DISPLAYED_CONFLICTS = 5;
const DefaultSecretSyncSourceFields = () => {
@@ -146,7 +144,7 @@ const DefaultSecretSyncSourceFields = () => {
<FieldDescription>
{importsFromDestination
? "Not available when the initial sync imports secrets from the destination. There is no single folder to import them back into."
- : `Also sync secrets from every folder beneath this path, however deep. Secret names must be unique across all of them, and the combined total can't exceed ${SECRET_SYNC_MAX_SECRETS} secrets.`}
+ : "Also sync secrets from every folder beneath this path, however deep. Secret names must be unique across all of them."}
</FieldDescription>
</FieldContent>
<Toggle