Skip to content

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

Update backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-fns.ts

Akhil Mohan52d54eff82cd
diff --git a/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-fns.ts
index e256308b42..5b92d80ac6 100644
--- a/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-fns.ts
@@ -193,6 +193,10 @@ export const sshPasswordRotationFactory: TRotationFactory<
const isSelfRotation = rotationMethod === SshPasswordRotationMethod.LoginAsTarget;
if (username === credentials.username)
throw new BadRequestError({ message: "Provided username is used in Infisical app connections." });
+
+ const privilegedAccounts = ['root', 'admin', 'administrator', 'sudo'];
+ if (privilegedAccounts.includes(username.toLowerCase()))
+ throw new BadRequestError({ message: "Cannot rotate passwords for privileged system accounts." });
// Determine which credentials to use for the SSH connection
let connectConfig: TSshConnectionConfig;