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 MAX_GENERATED_CREDENTIALS_LENGTH for azure credentials
carlosmonastyrskiccd7b0062e00
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 1b812f6dd0..5d0b7b1095 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@@ -37,15 +37,20 @@ export const azureClientSecretRotationFactory: TRotationFactory<await blockLocalAndPrivateIpAddresses(endpoint);const endDateTime = new Date();- console.log({ rotationInterval })endDateTime.setDate(endDateTime.getDate() + rotationInterval);+ const now = new Date();+ const formattedDate = `${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(+ 2,+ "0"+ )}-${now.getFullYear()}`;+try {const { data } = await request.post<AzureAddPasswordResponse>(endpoint,{passwordCredential: {- displayName: "Infisical Auto-Rotated Secret",+ displayName: `Infisical Rotated Secret (${formattedDate})`,endDateTime: endDateTime.toISOString()}},diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.tsindex 26717765b7..110d30bf3c 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts@@ -815,6 +815,14 @@ export const secretRotationV2ServiceFactory = ({return expandSecretRotation(secretRotation, kmsService);};+ const getMaxGeneratedCredentialsLength = (rotationType: SecretRotation): number => {+ if (rotationType === SecretRotation.AzureClientSecret) {+ return 1;+ }++ return MAX_GENERATED_CREDENTIALS_LENGTH;+ };+const rotateGeneratedCredentials = async (secretRotation: TSecretRotationV2Raw,{@@ -858,7 +866,7 @@ export const secretRotationV2ServiceFactory = ({kmsService});- const inactiveIndex = (activeIndex + 1) % MAX_GENERATED_CREDENTIALS_LENGTH;+ const inactiveIndex = (activeIndex + 1) % getMaxGeneratedCredentialsLength(type as SecretRotation);const inactiveCredentials = generatedCredentials[inactiveIndex];