Skip to content

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

checkpoint

Daniel Hougaard3603c693cca4
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts
index cabc46a388..876cd99d29 100644
--- a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts
@@ -6,5 +6,7 @@ export const AZURE_ENTRA_ID_SCIM_SYNC_LIST_OPTION: TSecretSyncListItem = {
name: "Azure Entra ID SCIM",
destination: SecretSync.AzureEntraIdScim,
connection: AppConnection.AzureEntraId,
- canImportSecrets: false
+ canImportSecrets: false,
+ supportsKeySchema: false,
+ supportsDisableSecretDeletion: false
};
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
index d3436ddb3e..df3b16a1be 100644
--- a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
@@ -25,7 +25,11 @@ const AzureEntraIdScimSyncDestinationConfigSchema = z.object({
.describe(SecretSyncs.DESTINATION_CONFIG.AZURE_ENTRA_ID_SCIM.secretKey)
});
-const AzureEntraIdScimSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
+const AzureEntraIdScimSyncOptionsConfig: TSyncOptionsConfig = {
+ canImportSecrets: false,
+ supportsKeySchema: false,
+ supportsDisableSecretDeletion: false
+};
export const AzureEntraIdScimSyncSchema = BaseSecretSyncSchema(
SecretSync.AzureEntraIdScim,
@@ -56,6 +60,8 @@ export const AzureEntraIdScimSyncListItemSchema = z
name: z.literal("Azure Entra ID SCIM"),
connection: z.literal(AppConnection.AzureEntraId),
destination: z.literal(SecretSync.AzureEntraIdScim),
- canImportSecrets: z.literal(false)
+ canImportSecrets: z.literal(false),
+ supportsKeySchema: z.literal(false),
+ supportsDisableSecretDeletion: z.literal(false)
})
.describe(JSON.stringify({ title: SECRET_SYNC_NAME_MAP[SecretSync.AzureEntraIdScim] }));
diff --git a/backend/src/services/secret-sync/secret-sync-schemas.ts b/backend/src/services/secret-sync/secret-sync-schemas.ts
index 6218cf3b09..4db0a0833e 100644
--- a/backend/src/services/secret-sync/secret-sync-schemas.ts
+++ b/backend/src/services/secret-sync/secret-sync-schemas.ts
@@ -6,12 +6,12 @@ import { SecretSyncs } from "@app/lib/api-docs";
import { removeTrailingSlash } from "@app/lib/fn";
import { slugSchema } from "@app/server/lib/schemas";
import { SecretSync, SecretSyncInitialSyncBehavior } from "@app/services/secret-sync/secret-sync-enums";
-import { SECRET_SYNC_CONNECTION_MAP } from "@app/services/secret-sync/secret-sync-maps";
+import { SECRET_SYNC_CONNECTION_MAP, SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";
import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
const BaseSyncOptionsSchema = <T extends AnyZodObject | undefined = undefined>({
destination,
- syncOptionsConfig: { canImportSecrets },
+ syncOptionsConfig: { canImportSecrets, supportsKeySchema = true, supportsDisableSecretDeletion = true },
merge,
isUpdateSchema
}: {
@@ -20,40 +20,50 @@ const BaseSyncOptionsSchema = <T extends AnyZodObject | undefined = undefined>({
merge?: T;
isUpdateSchema?: boolean;
}) => {
+ const syncName = SECRET_SYNC_NAME_MAP[destination];
+
const baseSchema = z.object({
initialSyncBehavior: (canImportSecrets
? z.nativeEnum(SecretSyncInitialSyncBehavior)
: z.literal(SecretSyncInitialSyncBehavior.OverwriteDestination)
).describe(SecretSyncs.SYNC_OPTIONS(destination).initialSyncBehavior),
- keySchema: z
- .string()
- .optional()
- .refine(
- (val) => {
- if (!val) return true;
+ keySchema: supportsKeySchema
+ ? z
+ .string()
+ .optional()
+ .refine(
+ (val) => {
+ if (!val) return true;
- const allowedOptionalPlaceholders = ["{{environment}}"];
+ const allowedOptionalPlaceholders = ["{{environment}}"];
- const allowedPlaceholdersRegexPart = ["{{secretKey}}", ...allowedOptionalPlaceholders]
- .map((p) => p.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")) // Escape regex special characters
- .join("|");
+ const allowedPlaceholdersRegexPart = ["{{secretKey}}", ...allowedOptionalPlaceholders]
+ .map((p) => p.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")) // Escape regex special characters
+ .join("|");
- const allowedContentRegex = new RE2(`^([a-zA-Z0-9_\\-/]|${allowedPlaceholdersRegexPart})*$`);
- const contentIsValid = allowedContentRegex.test(val);
+ const allowedContentRegex = new RE2(`^([a-zA-Z0-9_\\-/]|${allowedPlaceholdersRegexPart})*$`);
+ const contentIsValid = allowedContentRegex.test(val);
- // Check if {{secretKey}} is present
- const secretKeyRegex = new RE2(/\{\{secretKey\}\}/);
- const secretKeyIsPresent = secretKeyRegex.test(val);
+ // Check if {{secretKey}} is present
+ const secretKeyRegex = new RE2(/\{\{secretKey\}\}/);
+ const secretKeyIsPresent = secretKeyRegex.test(val);
- return contentIsValid && secretKeyIsPresent;
- },
- {
- message:
- "Key schema must include exactly one {{secretKey}} placeholder. It can also include {{environment}} placeholders. Only alphanumeric characters (a-z, A-Z, 0-9), dashes (-), underscores (_), and slashes (/) are allowed besides the placeholders."
- }
- )
- .describe(SecretSyncs.SYNC_OPTIONS(destination).keySchema),
- disableSecretDeletion: z.boolean().optional().describe(SecretSyncs.SYNC_OPTIONS(destination).disableSecretDeletion)
+ return contentIsValid && secretKeyIsPresent;
+ },
+ {
+ message:
+ "Key schema must include exactly one {{secretKey}} placeholder. It can also include {{environment}} placeholders. Only alphanumeric characters (a-z, A-Z, 0-9), dashes (-), underscores (_), and slashes (/) are allowed besides the placeholders."
+ }
+ )
+ .describe(SecretSyncs.SYNC_OPTIONS(destination).keySchema)
+ : z
+ .undefined({ message: `Key schema is not supported for ${syncName} syncs` })
+ .describe(`Not supported for ${syncName} syncs.`),
+ disableSecretDeletion: supportsDisableSecretDeletion
+ ? z.boolean().optional().describe(SecretSyncs.SYNC_OPTIONS(destination).disableSecretDeletion)
+ : z
+ .undefined({ message: `Disable secret deletion is not supported for ${syncName} syncs` })
+ .describe(`Not supported for ${syncName} syncs.`)
});
const schema = merge ? baseSchema.merge(merge) : baseSchema;
diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.ts
index 66ec8dcf3f..eb8806158a 100644
--- a/backend/src/services/secret-sync/secret-sync-types.ts
+++ b/backend/src/services/secret-sync/secret-sync-types.ts
@@ -335,6 +335,8 @@ export type TSecretSyncListItem =
export type TSyncOptionsConfig = {
canImportSecrets: boolean;
+ supportsKeySchema?: boolean;
+ supportsDisableSecretDeletion?: boolean;
};
export type TListSecretSyncsByProjectId = {
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index f824466590..5903196a05 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -154,6 +154,8 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
<FontAwesomeIcon className="mr-1" size="xs" icon={faTriangleExclamation} />
{destinationName} only supports overwriting destination secrets.{" "}
{!currentSyncOption.disableSecretDeletion &&
+ (syncOption?.supportsKeySchema !== false ||
+ syncOption?.supportsDisableSecretDeletion !== false) &&
`Secrets not present in Infisical will be removed from the destination. Consider adding a key schema or disabling secret deletion if you do not want existing secrets to be removed from ${destinationName}.`}
</p>
) : (
@@ -171,109 +173,114 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
)}
</>
)}
- <Controller
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- tooltipClassName="max-w-md"
- tooltipText={
- <div className="flex flex-col gap-3">
- <span>
- When a secret is synced, values will be injected into the key schema before it
- reaches the destination. This is useful for organization.
- </span>
-
- <div className="flex flex-col">
- <span>Available keys:</span>
- <ul className="list-disc pl-4 text-sm">
- <li>
- <code>{"{{secretKey}}"}</code> - The key of the secret
- </li>
- <li>
- <code>{"{{environment}}"}</code> - The environment which the secret is in
- (e.g. dev, staging, prod)
- </li>
- </ul>
- </div>
- </div>
- }
- isError={Boolean(error)}
- isOptional
- errorText={error?.message}
- label="Key Schema"
- helperText={
- <Tooltip
- className="max-w-md"
- content={
+ {syncOption?.supportsKeySchema !== false && (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipClassName="max-w-md"
+ tooltipText={
+ <div className="flex flex-col gap-3">
<span>
- We highly recommend configuring a{" "}
- <a
- href="https://infisical.com/docs/integrations/secret-syncs/overview#key-schemas"
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- >
- key schema
- </a>{" "}
- to ensure that Infisical only manages secrets in {destinationName} that match
- the key pattern.
- <br />
- <br />
- Destination secrets that do not match the schema will not be deleted or updated.
+ When a secret is synced, values will be injected into the key schema before it
+ reaches the destination. This is useful for organization.
</span>
- }
- >
- <div className="text-info">
- <span>Infisical strongly advises configuring a key schema</span>{" "}
- <FontAwesomeIcon icon={faCircleInfo} />
+
+ <div className="flex flex-col">
+ <span>Available keys:</span>
+ <ul className="list-disc pl-4 text-sm">
+ <li>
+ <code>{"{{secretKey}}"}</code> - The key of the secret
+ </li>
+ <li>
+ <code>{"{{environment}}"}</code> - The environment which the secret is in
+ (e.g. dev, staging, prod)
+ </li>
+ </ul>
+ </div>
</div>
- </Tooltip>
- }
- >
- <Input value={value} onChange={onChange} placeholder="INFISICAL_{{secretKey}}" />
- </FormControl>
- )}
- control={control}
- name="syncOptions.keySchema"
- />
- {AdditionalSyncOptionsFieldsComponent}
- <Controller
- control={control}
- name="syncOptions.disableSecretDeletion"
- render={({ field: { value, onChange }, fieldState: { error } }) => {
- return (
- <FormControl isError={Boolean(error)} errorText={error?.message}>
- <Switch
- className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
- id="auto-sync-enabled"
- thumbClassName="bg-mineshaft-800"
- onCheckedChange={onChange}
- isChecked={value}
- >
- <p className="w-44">
- Disable Secret Deletion{" "}
- <Tooltip
- className="max-w-md"
- content={
- <>
- <p>
- When enabled, Infisical will <span className="font-medium">not</span>{" "}
- remove secrets from the destination during a sync.
- </p>
- <p className="mt-4">
- Enable this option if you intend to manage some secrets manually outside
- of Infisical.
- </p>
- </>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />
- </Tooltip>
- </p>
- </Switch>
+ }
+ isError={Boolean(error)}
+ isOptional
+ errorText={error?.message}
+ label="Key Schema"
+ helperText={
+ <Tooltip
+ className="max-w-md"
+ content={
+ <span>
+ We highly recommend configuring a{" "}
+ <a
+ href="https://infisical.com/docs/integrations/secret-syncs/overview#key-schemas"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline"
+ >
+ key schema
+ </a>{" "}
+ to ensure that Infisical only manages secrets in {destinationName} that match
+ the key pattern.
+ <br />
+ <br />
+ Destination secrets that do not match the schema will not be deleted or
+ updated.
+ </span>
+ }
+ >
+ <div className="text-info">
+ <span>Infisical strongly advises configuring a key schema</span>{" "}
+ <FontAwesomeIcon icon={faCircleInfo} />
+ </div>
+ </Tooltip>
+ }
+ >
+ <Input value={value} onChange={onChange} placeholder="INFISICAL_{{secretKey}}" />
</FormControl>
- );
- }}
- />
+ )}
+ control={control}
+ name="syncOptions.keySchema"
+ />
+ )}
+ {AdditionalSyncOptionsFieldsComponent}
+ {syncOption?.supportsDisableSecretDeletion !== false && (
+ <Controller
+ control={control}
+ name="syncOptions.disableSecretDeletion"
+ render={({ field: { value, onChange }, fieldState: { error } }) => {
+ return (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Switch
+ className="bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"
+ id="auto-sync-enabled"
+ thumbClassName="bg-mineshaft-800"
+ onCheckedChange={onChange}
+ isChecked={value}
+ >
+ <p className="w-44">
+ Disable Secret Deletion{" "}
+ <Tooltip
+ className="max-w-md"
+ content={
+ <>
+ <p>
+ When enabled, Infisical will <span className="font-medium">not</span>{" "}
+ remove secrets from the destination during a sync.
+ </p>
+ <p className="mt-4">
+ Enable this option if you intend to manage some secrets manually outside
+ of Infisical.
+ </p>
+ </>
+ }
+ >
+ <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />
+ </Tooltip>
+ </p>
+ </Switch>
+ </FormControl>
+ );
+ }}
+ />
+ )}
</>
);
};
diff --git a/frontend/src/hooks/api/secretSyncs/types/index.ts b/frontend/src/hooks/api/secretSyncs/types/index.ts
index c65574dd9d..4756b173c0 100644
--- a/frontend/src/hooks/api/secretSyncs/types/index.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/index.ts
@@ -42,6 +42,8 @@ export type TSecretSyncOption = {
name: string;
destination: SecretSync;
canImportSecrets: boolean;
+ supportsKeySchema?: boolean;
+ supportsDisableSecretDeletion?: boolean;
enterprise?: boolean;
};