Fix MAX_GENERATED_CREDENTIALS_LENGTH for azure credentials

This commit is contained in:
carlosmonastyrski
2025-04-21 10:14:55 -03:00
parent c403ffa9f6
commit ccd7b0062e
2 changed files with 16 additions and 3 deletions
@@ -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];