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
only verify password if not verified yet
Matheus Nogueirab7b8c98b8eb8
diff --git a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-redfish-client.ts b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-redfish-client.tsindex 1adaf9c468..1b3818a882 100644--- a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-redfish-client.ts+++ b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-redfish-client.ts@@ -317,12 +317,14 @@ export const hpIloRedfishClientFactory = (data: { Password: newPassword },headers: { Authorization: authorization, "Content-Type": "application/json" }});+ return { isNewPasswordVerified: false };} catch (error) {// A failed PATCH may still have been applied: its response can be lost (gateway transport failures arrive as// non-Axios errors) and firmware can apply the change and still answer with an error. The rotation only stores// the new password on success, so failing here while the iLO already accepts it would leave Infisical holding a// password that no longer works- if (isPatchSent && (await isPasswordAccepted(targetUsername, newPassword))) return;+ if (isPatchSent && (await isPasswordAccepted(targetUsername, newPassword)))+ return { isNewPasswordVerified: true };throw new Error(`HP iLO password change failed: ${describeRedfishError(error)}`);}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.tsindex 4e3a884e32..d46f881b07 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@@ -239,10 +239,15 @@ export const hpIloRotationFactory: TRotationFactory<} as TSshConnectionConfig;return {- changePassword: (targetUsername, newPassword, currentPassword) =>- rotationMethod === HpIloRotationMethod.LoginAsTarget && currentPassword- ? rotateIloPasswordAsTarget(sshConfig, gatewayV2Service, targetUsername, currentPassword, newPassword)- : rotateIloPasswordAsAdmin(sshConfig, gatewayV2Service, targetUsername, newPassword),+ changePassword: async (targetUsername, newPassword, currentPassword) => {+ if (rotationMethod === HpIloRotationMethod.LoginAsTarget && currentPassword) {+ await rotateIloPasswordAsTarget(sshConfig, gatewayV2Service, targetUsername, currentPassword, newPassword);+ } else {+ await rotateIloPasswordAsAdmin(sshConfig, gatewayV2Service, targetUsername, newPassword);+ }+ // We still verify if the password works by running a SSH login+ return { isNewPasswordVerified: false };+ },verifyPassword: (targetUsername, password) =>verifyIloPassword(sshConfig, gatewayV2Service, targetUsername, password)};@@ -255,8 +260,8 @@ export const hpIloRotationFactory: TRotationFactory<throw new BadRequestError({ message: "Provided username is used in Infisical app connections." });const iloClient = await $getIloClient();- await iloClient.changePassword(username, newPassword, currentPassword);- await iloClient.verifyPassword(username, newPassword);+ const { isNewPasswordVerified } = await iloClient.changePassword(username, newPassword, currentPassword);+ if (!isNewPasswordVerified) await iloClient.verifyPassword(username, newPassword);return { username, password: newPassword };};diff --git a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-types.tsindex c6127618d2..6cf4ea7556 100644--- a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-types.ts+++ b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-types.ts@@ -23,6 +23,12 @@ export type THpIloRotationWithConnection = THpIloRotation & {export type THpIloRotationGeneratedCredentials = z.infer<typeof HpIloRotationGeneratedCredentialsSchema>;export type THpIloClient = {- changePassword: (targetUsername: string, newPassword: string, currentPassword?: string) => Promise<void>;+ // isNewPasswordVerified is true when the client already signed in with the new password, so the caller can skip a+ // second check that could fail and discard a password the iLO is known to accept+ changePassword: (+ targetUsername: string,+ newPassword: string,+ currentPassword?: string+ ) => Promise<{ isNewPasswordVerified: boolean }>;verifyPassword: (username: string, password: string) => Promise<void>;};