Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix secret rotation service type

adilson4cc2b934f803
diff --git a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts
index c2d1075e67..47449c43d1 100644
--- a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts
@@ -207,33 +207,28 @@ export const hpIloRotationFactory: TRotationFactory<
const { connection, parameters, secretsMapping, activeIndex } = secretRotation;
const { username, passwordRequirements, rotationMethod = HpIloRotationMethod.LoginAsRoot } = parameters;
- const sshConfig: TSshConnectionConfig = {
- method: connection.method,
- app: connection.app,
- orgId: connection.orgId,
- gatewayId: connection.gatewayId,
- credentials: connection.credentials
- } as TSshConnectionConfig;
-
- const $rotatePassword = async (currentPassword?: string): Promise<{ username: string; password: string }> => {
- const newPassword = generatePassword(passwordRequirements ?? HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS);
-
- const isSelfRotation = rotationMethod === HpIloRotationMethod.LoginAsTarget;
- if (username === connection.credentials.username)
- throw new BadRequestError({ message: "Provided username is used in Infisical app connections." });
-
+ const getRotationSshConfig = async (): Promise<TSshConnectionConfig> => {
const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
gatewayId: connection.gatewayId,
gatewayPoolId: connection.gatewayPoolId
});
-
- const sshConfig: TSshConnectionConfig = {
+ return {
method: connection.method,
app: connection.app,
orgId: connection.orgId,
gatewayId: effectiveGatewayId,
credentials: connection.credentials
} as TSshConnectionConfig;
+ };
+
+ const $rotatePassword = async (currentPassword?: string): Promise<{ username: string; password: string }> => {
+ const newPassword = generatePassword(passwordRequirements ?? HP_ILO_DEFAULT_PASSWORD_REQUIREMENTS);
+
+ const isSelfRotation = rotationMethod === HpIloRotationMethod.LoginAsTarget;
+ if (username === connection.credentials.username)
+ throw new BadRequestError({ message: "Provided username is used in Infisical app connections." });
+
+ const sshConfig = await getRotationSshConfig();
if (isSelfRotation && currentPassword) {
await rotateIloPasswordAsTarget(sshConfig, gatewayV2Service, username, currentPassword, newPassword);
@@ -285,6 +280,7 @@ export const hpIloRotationFactory: TRotationFactory<
username: activeUsername,
password
}) => {
+ const sshConfig = await getRotationSshConfig();
await verifyIloPassword(sshConfig, gatewayV2Service, activeUsername, password);
};
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.ts
index fe451ef1f2..40da430d80 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
@@ -1553,7 +1553,8 @@ export const secretRotationV2ServiceFactory = ({
appConnectionDAL,
kmsService,
gatewayService,
- gatewayV2Service
+ gatewayV2Service,
+ gatewayPoolService
);
if (!rotationFactory.checkActiveCredentials)