Skip to content

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

fix: update password sanitization in iLO command error handling

Victor Hugo dos Santos3b22e8200302
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 890d84c361..ff6579e8f7 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
@@ -84,7 +84,7 @@ const executeIloShell = (conn: Client, command: string): Promise<string> => {
settled = true;
conn.end();
const passwordPattern = new RE2("password=[^\\s]+", "gi");
- const sanitizedBuffer = buffer.replace(passwordPattern, "password=***");
+ const sanitizedBuffer = passwordPattern.replace(buffer, "password=***");
reject(new Error(`iLO command failed: ${sanitizedBuffer}`));
}
});
diff --git a/backend/src/services/app-connection/ssh/ssh-connection-fns.ts b/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
index 1f6cce4104..e1e7ef37b3 100644
--- a/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
+++ b/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
@@ -124,25 +124,27 @@ export const getSshConnectionClient = async (
// eslint-disable-next-line no-await-in-loop -- Intentional sequential retry logic
for (let attempt = 1; attempt <= maxRetries; attempt += 1) {
try {
- logger.info(`SSH connection attempt ${attempt}/${maxRetries} to ${targetHost}:${targetPort}`);
+ logger.info(`[host=${targetHost}] [port=${targetPort}] SSH connection attempt ${attempt}/${maxRetries}`);
// eslint-disable-next-line no-await-in-loop
const client = await attemptSshConnection(credentials, targetHost, targetPort);
if (attempt > 1) {
- logger.info(`SSH connection succeeded on attempt ${attempt}`);
+ logger.info(`[host=${targetHost}] [port=${targetPort}] SSH connection succeeded on attempt ${attempt}`);
}
return client;
} catch (error) {
lastError = error as Error;
const errorMessage = lastError.message ?? "";
- logger.info(`SSH connection attempt ${attempt} failed: ${errorMessage}`);
+ logger.info(
+ `[host=${targetHost}] [port=${targetPort}] SSH connection attempt ${attempt} failed: ${errorMessage}`
+ );
if (!isRetryableError(errorMessage)) {
throw lastError;
}
if (attempt < maxRetries) {
- logger.info(`Retrying SSH connection in ${retryDelay}ms...`);
+ logger.info(`[host=${targetHost}] [port=${targetPort}] Retrying SSH connection in ${retryDelay}ms`);
// eslint-disable-next-line no-await-in-loop
await delay(retryDelay);
}
@@ -196,20 +198,22 @@ export const validateSshConnectionCredentials = async (
gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">
) => {
const { credentials } = config;
- logger.info(`SSH connection validation: Attempting connection to ${credentials.host}:${credentials.port}`);
+ logger.info(`[host=${credentials.host}] [port=${credentials.port}] SSH connection validation: Attempting connection`);
try {
await executeWithPotentialGateway(config, gatewayV2Service, async (targetHost, targetPort) => {
- logger.info(`SSH connection validation: Connecting to ${targetHost}:${targetPort}`);
+ logger.info(`[host=${targetHost}] [port=${targetPort}] SSH connection validation: Connecting`);
const client = await getSshConnectionClient(config, targetHost, targetPort);
- logger.info("SSH connection validation: Connection successful");
+ logger.info(`[host=${targetHost}] [port=${targetPort}] SSH connection validation: Connection successful`);
client.destroy();
});
return config.credentials;
} catch (error) {
const errorMessage = (error as Error)?.message ?? "";
- logger.info(`SSH connection validation: Failed with error: ${errorMessage}`);
+ logger.info(
+ `[host=${credentials.host}] [port=${credentials.port}] SSH connection validation failed: ${errorMessage}`
+ );
throw new BadRequestError({
message: `Unable to validate connection: ${errorMessage || "verify credentials"}`
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx
index 2c47366686..5a14cd29c7 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/HpIloRotationParametersFields.tsx
@@ -35,7 +35,7 @@ export const HpIloRotationParametersFields = () => {
>();
const id = watch("id");
- const rotationMethod = watch("parameters.rotationMethod", HpIloRotationMethod.LoginAsTarget);
+ const rotationMethod = watch("parameters.rotationMethod", HpIloRotationMethod.LoginAsRoot);
const isUpdate = Boolean(id);
return (
@@ -43,7 +43,7 @@ export const HpIloRotationParametersFields = () => {
<Controller
name="parameters.rotationMethod"
control={control}
- defaultValue={HpIloRotationMethod.LoginAsTarget}
+ defaultValue={HpIloRotationMethod.LoginAsRoot}
render={({ field: { value, onChange }, fieldState: { error } }) => (
<FormControl
tooltipText={