diff --git a/backend/src/db/migrations/20250122055102_secret-sync.ts b/backend/src/db/migrations/20250122055102_secret-sync.ts index d5d00673b..5f37950e3 100644 --- a/backend/src/db/migrations/20250122055102_secret-sync.ts +++ b/backend/src/db/migrations/20250122055102_secret-sync.ts @@ -10,7 +10,7 @@ export async function up(knex: Knex): Promise { t.string("name", 32).notNullable(); t.string("description"); t.string("destination").notNullable(); - t.boolean("isEnabled").notNullable().defaultTo(true); + t.boolean("isAutoSyncEnabled").notNullable().defaultTo(true); t.integer("version").defaultTo(1).notNullable(); t.jsonb("destinationConfig").notNullable(); t.jsonb("syncOptions").notNullable(); diff --git a/backend/src/db/schemas/secret-syncs.ts b/backend/src/db/schemas/secret-syncs.ts index 995a0f97a..0e0728e87 100644 --- a/backend/src/db/schemas/secret-syncs.ts +++ b/backend/src/db/schemas/secret-syncs.ts @@ -12,7 +12,7 @@ export const SecretSyncsSchema = z.object({ name: z.string(), description: z.string().nullable().optional(), destination: z.string(), - isEnabled: z.boolean().default(true), + isAutoSyncEnabled: z.boolean().default(true), version: z.number().default(1), destinationConfig: z.unknown(), syncOptions: z.unknown(), diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts index 4994ea751..800788179 100644 --- a/backend/src/lib/api-docs/constants.ts +++ b/backend/src/lib/api-docs/constants.ts @@ -1671,7 +1671,7 @@ export const SecretSyncs = { connectionId: `The ID of the ${ APP_CONNECTION_NAME_MAP[SECRET_SYNC_CONNECTION_MAP[destination]] } Connection to use for syncing.`, - isEnabled: `Whether secrets should be synced automatically or not.`, + isAutoSyncEnabled: `Whether secrets should be automatically synced when changes occur at the source location or not.`, syncOptions: "Optional parameters to modify how secrets are synced." }; }, @@ -1686,7 +1686,7 @@ export const SecretSyncs = { environment: `The updated slug of the project environment to sync secrets from.`, secretPath: `The updated folder path to sync secrets from.`, description: `The updated description of the ${destinationName} Sync.`, - isEnabled: `Whether secrets should be synced automatically or not.`, + isAutoSyncEnabled: `Whether secrets should be automatically synced when changes occur at the source location or not.`, syncOptions: "Optional parameters to modify how secrets are synced." }; }, diff --git a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-endpoints.ts b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-endpoints.ts index a1ca27921..31826f86f 100644 --- a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-endpoints.ts +++ b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-endpoints.ts @@ -28,7 +28,7 @@ export const registerSyncSecretsEndpoints = ; updateSchema: z.ZodType<{ connectionId?: string; @@ -38,6 +38,7 @@ export const registerSyncSecretsEndpoints = ; responseSchema: z.ZodTypeAny; }) => { diff --git a/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-schemas.ts b/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-schemas.ts index 8a297c887..e89096baa 100644 --- a/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-schemas.ts +++ b/backend/src/services/secret-sync/aws-parameter-store/aws-parameter-store-sync-schemas.ts @@ -16,7 +16,7 @@ const AwsParameterStoreSyncDestinationConfigSchema = z.object({ .trim() .min(1, "Parameter Store Path required") .max(2048, "Cannot exceed 2048 characters") - .regex(/^\/([/]|(([\w-]+\/)+))?$/) + .regex(/^\/([/]|(([\w-]+\/)+))?$/, 'Invalid path - must follow "/example/path/" format') .describe(SecretSyncs.DESTINATION_CONFIG.AWS_PARAMETER_STORE.PATH) }); diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.ts index 90984da17..de39fef02 100644 --- a/backend/src/services/secret-sync/secret-sync-fns.ts +++ b/backend/src/services/secret-sync/secret-sync-fns.ts @@ -73,7 +73,7 @@ export const SecretSyncFns = { return GithubSyncFns.syncSecrets(secretSync, secretMap); default: throw new Error( - `Unhandled sync destination for push secrets: ${(secretSync as TSecretSyncWithCredentials).destination}` + `Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}` ); } }, @@ -88,7 +88,7 @@ export const SecretSyncFns = { break; default: throw new Error( - `Unhandled sync destination for push secrets: ${(secretSync as TSecretSyncWithCredentials).destination}` + `Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}` ); } @@ -105,7 +105,7 @@ export const SecretSyncFns = { return GithubSyncFns.removeSecrets(secretSync, secretMap); default: throw new Error( - `Unhandled sync destination for removing secrets: ${(secretSync as TSecretSyncWithCredentials).destination}` + `Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}` ); } } diff --git a/backend/src/services/secret-sync/secret-sync-queue.ts b/backend/src/services/secret-sync/secret-sync-queue.ts index 7b1c5643a..d2bcdb590 100644 --- a/backend/src/services/secret-sync/secret-sync-queue.ts +++ b/backend/src/services/secret-sync/secret-sync-queue.ts @@ -827,7 +827,7 @@ export const secretSyncQueueFactory = ({ `Could not find folder at path "${secretPath}" for environment with slug "${environmentSlug}" in project with ID "${projectId}"` ); - const secretSyncs = await secretSyncDAL.find({ folderId: folder.id, isEnabled: true }); + const secretSyncs = await secretSyncDAL.find({ folderId: folder.id, isAutoSyncEnabled: true }); await Promise.all(secretSyncs.map((secretSync) => queueSecretSyncSyncSecretsById({ syncId: secretSync.id }))); }; diff --git a/backend/src/services/secret-sync/secret-sync-schemas.ts b/backend/src/services/secret-sync/secret-sync-schemas.ts index 92dd17422..9821c4e1d 100644 --- a/backend/src/services/secret-sync/secret-sync-schemas.ts +++ b/backend/src/services/secret-sync/secret-sync-schemas.ts @@ -65,7 +65,7 @@ export const GenericCreateSecretSyncFieldsSchema = (destination: SecretSync, syn .min(1, "Secret path required") .transform(removeTrailingSlash) .describe(SecretSyncs.CREATE(destination).secretPath), - isEnabled: z.boolean().default(true).describe(SecretSyncs.CREATE(destination).isEnabled), + isAutoSyncEnabled: z.boolean().default(true).describe(SecretSyncs.CREATE(destination).isAutoSyncEnabled), syncOptions: SyncOptionsSchema(destination, syncOptionsConfig).describe(SecretSyncs.CREATE(destination).syncOptions) }); @@ -89,7 +89,7 @@ export const GenericUpdateSecretSyncFieldsSchema = (destination: SecretSync, syn .transform(removeTrailingSlash) .optional() .describe(SecretSyncs.UPDATE(destination).secretPath), - isEnabled: z.boolean().optional().describe(SecretSyncs.UPDATE(destination).isEnabled), + isAutoSyncEnabled: z.boolean().optional().describe(SecretSyncs.UPDATE(destination).isAutoSyncEnabled), syncOptions: SyncOptionsSchema(destination, syncOptionsConfig) .optional() .describe(SecretSyncs.UPDATE(destination).syncOptions) diff --git a/backend/src/services/secret-sync/secret-sync-service.ts b/backend/src/services/secret-sync/secret-sync-service.ts index 40af37e79..4ce2fd2d5 100644 --- a/backend/src/services/secret-sync/secret-sync-service.ts +++ b/backend/src/services/secret-sync/secret-sync-service.ts @@ -218,14 +218,14 @@ export const secretSyncServiceFactory = ({ const sync = await secretSyncDAL.create({ folderId: folder.id, ...params, - ...(params.isEnabled && { syncStatus: SecretSyncStatus.Pending }), + ...(params.isAutoSyncEnabled && { syncStatus: SecretSyncStatus.Pending }), projectId }); return sync; }); - if (secretSync.isEnabled) await secretSyncQueue.queueSecretSyncSyncSecretsById({ syncId: secretSync.id }); + if (secretSync.isAutoSyncEnabled) await secretSyncQueue.queueSecretSyncSyncSecretsById({ syncId: secretSync.id }); return secretSync as TSecretSync; }; @@ -317,18 +317,19 @@ export const secretSyncServiceFactory = ({ }); } - const isEnabled = params.isEnabled ?? secretSync.isEnabled; + const isAutoSyncEnabled = params.isAutoSyncEnabled ?? secretSync.isAutoSyncEnabled; const updatedSync = await secretSyncDAL.updateById(syncId, { ...params, - ...(isEnabled && folderId && { syncStatus: SecretSyncStatus.Pending }), + ...(isAutoSyncEnabled && folderId && { syncStatus: SecretSyncStatus.Pending }), folderId }); return updatedSync; }); - if (updatedSecretSync.isEnabled) await secretSyncQueue.queueSecretSyncSyncSecretsById({ syncId: secretSync.id }); + if (updatedSecretSync.isAutoSyncEnabled) + await secretSyncQueue.queueSecretSyncSyncSecretsById({ syncId: secretSync.id }); return updatedSecretSync as TSecretSync; }; diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.ts index b46ededc3..eade6671d 100644 --- a/backend/src/services/secret-sync/secret-sync-types.ts +++ b/backend/src/services/secret-sync/secret-sync-types.ts @@ -51,7 +51,7 @@ export type TCreateSecretSyncDTO = Pick> & { diff --git a/docs/integrations/secret-syncs/aws-parameter-store.mdx b/docs/integrations/secret-syncs/aws-parameter-store.mdx index 504b386b0..a9055ff1e 100644 --- a/docs/integrations/secret-syncs/aws-parameter-store.mdx +++ b/docs/integrations/secret-syncs/aws-parameter-store.mdx @@ -40,7 +40,7 @@ description: "Learn how to configure an AWS Parameter Store Sync for Infisical." - **Overwrite Destination Secrets**: Removes any secrets at the destination endpoint not present in Infisical. - **Import Secrets (Prioritize Infisical)**: Imports secrets from the destination endpoint prior to syncing, prioritizing values present in Infisical if secrets conflict. - **Import Secrets (Prioritize Parameter Store)**: Imports secrets from the destination endpoint prior to syncing, prioritizing values present in Parameter Store if secrets conflict. - - **Enabled**: If enabled, secrets will automatically be synced from the source. Disable to prevent syncing until enabled. + - **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only. 6. Configure the **Details** of your Parameter Store Sync, then click **Next**. ![Configure Details](/images/secret-syncs/aws-parameter-store/aws-parameter-store-details.png) diff --git a/docs/integrations/secret-syncs/github.mdx b/docs/integrations/secret-syncs/github.mdx index 714d0a2aa..4c6d52efb 100644 --- a/docs/integrations/secret-syncs/github.mdx +++ b/docs/integrations/secret-syncs/github.mdx @@ -62,7 +62,7 @@ description: "Learn how to configure a GitHub Sync for Infisical." GitHub does not support importing secrets. - - **Enabled**: If enabled, secrets will automatically be synced from the source. Disable to prevent syncing until enabled. + - **Auto-Sync Enabled**: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only. 6. Configure the **Details** of your GitHub Sync, then click **Next**. ![Configure Details](/images/secret-syncs/github/github-details.png) diff --git a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx index ca1d363bd..e7721f113 100644 --- a/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx +++ b/frontend/src/components/secret-syncs/forms/CreateSecretSyncForm.tsx @@ -51,7 +51,7 @@ export const CreateSecretSyncForm = ({ destination, onComplete, onCancel }: Prop resolver: zodResolver(SecretSyncFormSchema), defaultValues: { destination, - isEnabled: true, + isAutoSyncEnabled: true, syncOptions: { initialSyncBehavior: syncOption?.canImportSecrets ? undefined @@ -161,26 +161,26 @@ export const CreateSecretSyncForm = ({ destination, onComplete, onCancel }: Prop { return ( -

{value ? "Enabled" : "Disabled"}

+

Auto-Sync {value ? "Enabled" : "Disabled"}

); @@ -204,9 +204,11 @@ export const CreateSecretSyncForm = ({ destination, onComplete, onCancel }: Prop containerClassName="-mt-5" onCheckedChange={(isChecked) => setConfirmOverwrite(Boolean(isChecked))} > -

+

I understand all secrets present in the configured {destinationName} destination will - be removed that are not present within Infisical. + be removed if they are not present within Infisical.

)} @@ -222,7 +224,6 @@ export const CreateSecretSyncForm = ({ destination, onComplete, onCancel }: Prop > {isFinalStep ? "Create Sync" : "Next"} - {} {selectedTabIndex > 0 && (