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
Fix bug on azure revokeCredentials and limit expiration to 5 years
carlosmonastyrskia01a9f3f77bc
diff --git a/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns.tsindex bf134ecf32..32e2a5459f 100644--- a/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns.ts@@ -1,3 +1,4 @@+/* eslint-disable no-await-in-loop */import { AxiosError } from "axios";import {@@ -18,6 +19,11 @@ import { getAzureConnectionAccessToken } from "@app/services/app-connection/azurconst GRAPH_API_BASE = "https://graph.microsoft.com/v1.0";+const sleep = async () =>+ new Promise((resolve) => {+ setTimeout(resolve, 1000);+ });+export const azureClientSecretRotationFactory: TRotationFactory<TAzureClientSecretRotationWithConnection,TAzureClientSecretRotationGeneratedCredentials@@ -41,13 +47,16 @@ export const azureClientSecretRotationFactory: TRotationFactory<"0")}-${now.getFullYear()}`;+ const endDateTime = new Date();+ endDateTime.setFullYear(now.getFullYear() + 5);+try {const { data } = await request.post<AzureAddPasswordResponse>(endpoint,{passwordCredential: {displayName: `Infisical Rotated Secret (${formattedDate})`,- endDateTime: "2299-12-31T23:59:59Z" // effectively no expiration+ endDateTime: endDateTime.toISOString()}},{@@ -130,7 +139,10 @@ export const azureClientSecretRotationFactory: TRotationFactory<) => {if (!credentials?.length) return callback();- await Promise.all(credentials.map(({ keyId }) => revokeCredential(keyId)));+ for (const { keyId } of credentials) {+ await revokeCredential(keyId);+ await sleep();+ }return callback();};