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
feat(secret-rotation): add check for ongoing rotation to prevent overlapping executions
Dimitris Staratzisa04abb32cc93
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 e99e62a249..a8b20d68d1 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@@ -822,6 +822,15 @@ export const secretRotationV2ServiceFactory = ({message: `Secret Rotation with ID "${rotationId}" is not configured for ${SECRET_ROTATION_NAME_MAP[type]}`});+ // A running rotation saves the next rotation time from the settings it started with, so an edit made+ // meanwhile would have its schedule overwritten when the rotation finishes.+ const isRotationOccurring = Boolean(await keyStore.getItem(KeyStorePrefixes.SecretRotationLock(secretRotation.id)));++ if (isRotationOccurring)+ throw new BadRequestError({+ message: "A rotation is currently in progress for this secret rotation. Please try again shortly."+ });+const nextRotationAt = calculateNextRotationAt({...(secretRotation as TSecretRotationV2),...payload,