Skip to content

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

feat: review changes

=12fd03fdce3b
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 89c2171ab9..848d3d400d 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
@@ -67,7 +67,7 @@ export const CreateSshPasswordRotationSchema = BaseCreateSecretRotationSchema(Se
secretsMapping: SshPasswordRotationSecretsMappingSchema,
temporaryParameters: z
.object({
- password: z.string().min(1, "Password required").describe(SecretRotations.PARAMETERS.SSH_PASSWORD.password)
+ password: z.string().optional().describe(SecretRotations.PARAMETERS.SSH_PASSWORD.password)
})
.optional()
})
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/ssh-password-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/ssh-password-rotation-schema.ts
index 098e4f3375..55d3eaf4ad 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/ssh-password-rotation-schema.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/ssh-password-rotation-schema.ts
@@ -15,7 +15,7 @@ export const SshPasswordRotationSchema = z
}),
secretsMapping: z.object({
username: z.string().trim().min(1, "Username required"),
- password: z.string().trim().optional()
+ password: z.string().trim().min(1, "Password required")
}),
temporaryParameters: z
.object({
@@ -23,4 +23,18 @@ export const SshPasswordRotationSchema = z
})
.optional()
})
- .merge(BaseSecretRotationSchema);
+ .merge(BaseSecretRotationSchema)
+ .superRefine((val, ctx) => {
+ if (val.type === SecretRotation.SshPassword) {
+ if (
+ val.parameters.rotationMethod === SshPasswordRotationMethod.LoginAsTarget &&
+ !val.temporaryParameters?.password
+ ) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Password required",
+ path: ["temporaryParameters", "password"]
+ });
+ }
+ }
+ });