Skip to content

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

fix: enhance buffer management in iLO shell execution

Victor Hugo dos Santosb74f747ca950
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 ff6579e8f7..25596f9929 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
@@ -41,6 +41,7 @@ const ILO_PROMPT = "hpiLO->";
const COMMAND_COMPLETED = "status_tag=COMMAND COMPLETED";
const COMMAND_FAILED = "COMMAND PROCESSING FAILED";
const CONNECTION_TIMEOUT = 15000;
+const MAX_BUFFER_SIZE = 64 * 1024;
const executeIloShell = (conn: Client, command: string): Promise<string> => {
return new Promise((resolve, reject) => {
@@ -67,6 +68,14 @@ const executeIloShell = (conn: Client, command: string): Promise<string> => {
buffer += data.toString();
+ if (buffer.length > MAX_BUFFER_SIZE) {
+ clearTimeout(timeout);
+ settled = true;
+ conn.end();
+ reject(new Error("iLO shell response exceeded maximum buffer size"));
+ return;
+ }
+
if (buffer.includes(ILO_PROMPT) && !commandSent) {
commandSent = true;
stream.write(`${command}\n`);
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 2b9f197339..de37c72631 100644
--- a/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
+++ b/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
@@ -46,7 +46,17 @@ const attemptSshConnection = (
host: targetHost,
port: targetPort,
readyTimeout: SSH_TIMEOUT,
- tryKeyboard: false
+ tryKeyboard: false,
+ algorithms: {
+ serverHostKey: [
+ "ssh-rsa", // Required for HP iLO 4/5
+ "ssh-dss"
+ ],
+ kex: [
+ "diffie-hellman-group14-sha1", // Required for HP iLO 4/5
+ "diffie-hellman-group1-sha1"
+ ]
+ }
};
client.on("error", (err: Error) => {