Skip to content

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

feat(api): minor bug fixes

=5a65202a5ee7
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 4c377de801..06710fc265 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
@@ -1415,7 +1415,7 @@ export const secretRotationV2ServiceFactory = ({
});
ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionSecretRotationActions.Edit,
+ ProjectPermissionSecretRotationActions.RotateSecrets,
subject(ProjectPermissionSub.SecretRotation, {
environment: environment.slug,
secretPath: folder.path
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 a44945938d..e256308b42 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
@@ -89,7 +89,7 @@ const changeSelfPassword = async (client: Client, oldPassword: string, newPasswo
stream.end("exit\n");
reject(new Error(`Password change timed out. Output: ${output}`));
}
- }, 30000); // 30 second timeout
+ }, 15000); // 15 second timeout
stream.on("data", (data: Buffer) => {
const text = data.toString();
@@ -112,15 +112,6 @@ const changeSelfPassword = async (client: Client, oldPassword: string, newPasswo
// Confirm new password prompt
stream.write(`${newPassword}\n`);
step = 3;
- } else if (
- step >= 1 &&
- (lower.includes("error") ||
- lower.includes("fail") ||
- lower.includes("unchanged") ||
- lower.includes("authentication"))
- ) {
- // Password change failed
- errorMessage = text.trim();
} else if (
step === 3 &&
(lower.includes("success") || lower.includes("updated") || lower.includes("changed"))
@@ -129,6 +120,10 @@ const changeSelfPassword = async (client: Client, oldPassword: string, newPasswo
completed = true;
clearTimeout(timeout);
stream.end("exit\n");
+ } else if (step >= 1 && (lower.includes("error") || lower.includes("fail") || lower.includes("unchanged"))) {
+ // Password change failed
+ errorMessage = text.trim();
+ stream.end("exit\n");
}
});
@@ -253,9 +248,6 @@ export const sshPasswordRotationFactory: TRotationFactory<
TSshPasswordRotationGeneratedCredentials,
TSshPasswordRotationInput["temporaryParameters"]
> = async (callback, temporaryParameters) => {
- // For both self and managed rotation, we need the current password for initial setup
- // Self rotation: to authenticate as the user and change their own password
- // Managed rotation: to verify the temporary password works before rotating
const credentials = await $rotatePassword(temporaryParameters?.password);
return callback(credentials);
};
diff --git a/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-schemas.ts
index 84ed709916..f8b16bdc5a 100644
--- a/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-schemas.ts
+++ b/backend/src/ee/services/secret-rotation-v2/ssh-password/ssh-password-rotation-schemas.ts
@@ -65,11 +65,13 @@ export const CreateSshPasswordRotationSchema = BaseCreateSecretRotationSchema(Se
.superRefine((val, ctx) => {
// Password is required for both rotation methods during initial setup
// Self rotation: needed to authenticate as the user
- // Managed rotation: needed to verify initial credentials
- if (!val.temporaryParameters?.password) {
+ if (
+ val.parameters.rotationMethod === SshPasswordRotationMethod.LoginAsTarget &&
+ !val.temporaryParameters?.password
+ ) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
- message: "Current password is required for initial rotation setup",
+ message: "Current password is required for initial rotation setup in login as root method",
path: ["temporaryParameters", "password"]
});
}
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 4416605948..fb1c7062be 100644
--- a/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
+++ b/backend/src/services/app-connection/ssh/ssh-connection-fns.ts
@@ -41,6 +41,21 @@ export const getSshConnectionClient = async (
client.on("error", (err: Error) => {
client.destroy();
+ if (err instanceof Error) {
+ // Check for common authentication failure messages
+ if (
+ err.message.includes("authentication") ||
+ err.message.includes("All configured authentication methods failed") ||
+ err.message.includes("publickey")
+ ) {
+ reject(new Error("SSH Error: Account credentials invalid."));
+ }
+
+ if (err.message === "Connection timeout") {
+ reject(new Error("SSH Error: Connection timeout. Verify that the SSH server is reachable"));
+ }
+ }
+
reject(new Error(`SSH Error: ${err.message}`));
});