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
add option to not delete secrets in parameter store
Vladyslav Matsiiako79704e9c9818
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 3363854726..83e5c11ae5 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -625,7 +625,8 @@ export const INTEGRATION = {shouldAutoRedeploy: "Used by Render to trigger auto deploy.",secretGCPLabel: "The label for GCP secrets.",secretAWSTag: "The tags for AWS secrets.",- kmsKeyId: "The ID of the encryption key from AWS KMS."+ kmsKeyId: "The ID of the encryption key from AWS KMS.",+ shouldDisableDelete: "The flag to disable deletion of secrets in AWS Parameter Store."}},UPDATE: {diff --git a/backend/src/server/routes/v1/integration-router.ts b/backend/src/server/routes/v1/integration-router.tsindex f908aa1fcd..975e6e7c86 100644--- a/backend/src/server/routes/v1/integration-router.ts+++ b/backend/src/server/routes/v1/integration-router.ts@@ -66,7 +66,8 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {).optional().describe(INTEGRATION.CREATE.metadata.secretAWSTag),- kmsKeyId: z.string().optional().describe(INTEGRATION.CREATE.metadata.kmsKeyId)+ kmsKeyId: z.string().optional().describe(INTEGRATION.CREATE.metadata.kmsKeyId),+ shouldDisableDelete: z.boolean().optional().describe(INTEGRATION.CREATE.metadata.shouldDisableDelete)}).default({})}),diff --git a/backend/src/services/integration-auth/integration-sync-secret.ts b/backend/src/services/integration-auth/integration-sync-secret.tsindex 1681598479..4e1dbd7ae7 100644--- a/backend/src/services/integration-auth/integration-sync-secret.ts+++ b/backend/src/services/integration-auth/integration-sync-secret.ts@@ -517,20 +517,22 @@ const syncSecretsAWSParameterStore = async ({}));- // Identify secrets to delete- await Promise.all(- Object.keys(awsParameterStoreSecretsObj).map(async (key) => {- if (!(key in secrets)) {- // case:- // -> delete secret- await ssm- .deleteParameter({- Name: awsParameterStoreSecretsObj[key].Name as string- })- .promise();- }- })- );+ if (!metadata.shouldDisableDelete) {+ // Identify secrets to delete+ await Promise.all(+ Object.keys(awsParameterStoreSecretsObj).map(async (key) => {+ if (!(key in secrets)) {+ // case:+ // -> delete secret+ await ssm+ .deleteParameter({+ Name: awsParameterStoreSecretsObj[key].Name as string+ })+ .promise();+ }+ })+ );+ }};/**diff --git a/backend/src/services/integration/integration-types.ts b/backend/src/services/integration/integration-types.tsindex 56ea463501..1913dd31f3 100644--- a/backend/src/services/integration/integration-types.ts+++ b/backend/src/services/integration/integration-types.ts@@ -27,6 +27,7 @@ export type TCreateIntegrationDTO = {value: string;}[];kmsKeyId?: string;+ shouldDisableDelete?: boolean;};} & Omit<TProjectPermission, "projectId">;diff --git a/frontend/src/hooks/api/integrations/queries.tsx b/frontend/src/hooks/api/integrations/queries.tsxindex b855dbf739..2d4c8a313b 100644--- a/frontend/src/hooks/api/integrations/queries.tsx+++ b/frontend/src/hooks/api/integrations/queries.tsx@@ -68,6 +68,7 @@ export const useCreateIntegration = () => {value: string;}[];kmsKeyId?: string;+ shouldDisableDelete?: boolean;};}) => {const {diff --git a/frontend/src/pages/integrations/aws-parameter-store/create.tsx b/frontend/src/pages/integrations/aws-parameter-store/create.tsxindex cc80d2f29d..ee9bf30b9e 100644--- a/frontend/src/pages/integrations/aws-parameter-store/create.tsx+++ b/frontend/src/pages/integrations/aws-parameter-store/create.tsx@@ -89,6 +89,7 @@ export default function AWSParameterStoreCreateIntegrationPage() {const [isLoading, setIsLoading] = useState(false);const [shouldTag, setShouldTag] = useState(false);+ const [shouldDisableDelete, setShouldDisableDelete] = useState(false);const [tagKey, setTagKey] = useState("");const [tagValue, setTagValue] = useState("");const [kmsKeyId, setKmsKeyId] = useState("");@@ -144,7 +145,8 @@ export default function AWSParameterStoreCreateIntegrationPage() {]}: {}),- ...(kmsKeyId && { kmsKeyId })+ ...(kmsKeyId && { kmsKeyId }),+ ...(shouldDisableDelete && { shouldDisableDelete })}});@@ -273,6 +275,15 @@ export default function AWSParameterStoreCreateIntegrationPage() {exit={{ opacity: 0, translateX: 30 }}><div className="mt-2 ml-1">+ <Switch+ id="delete-aws"+ onCheckedChange={() => setShouldDisableDelete(!shouldDisableDelete)}+ isChecked={shouldDisableDelete}+ >+ Disable deleting secrets in AWS Parameter Store+ </Switch>+ </div>+ <div className="mt-4 ml-1"><Switchid="tag-aws"onCheckedChange={() => setShouldTag(!shouldTag)}diff --git a/pg-migrator/src/models/integration/types.ts b/pg-migrator/src/models/integration/types.tsindex 635182cd23..6bd0bb1a47 100644--- a/pg-migrator/src/models/integration/types.ts+++ b/pg-migrator/src/models/integration/types.ts@@ -10,4 +10,5 @@ export type Metadata = {value: string;}[]kmsKeyId?: string;+ shouldDisableDelete?: boolean;}\ No newline at end of file