Skip to content

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

fix mysql

x0322052f326e021c9c
diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.test.ts b/backend/src/ee/services/pam-account/pam-account-schemas.test.ts
index 97e4175d0d..a02767ceaf 100644
--- a/backend/src/ee/services/pam-account/pam-account-schemas.test.ts
+++ b/backend/src/ee/services/pam-account/pam-account-schemas.test.ts
@@ -67,6 +67,34 @@ describe("buildPamAccountTypeMetadata", () => {
});
});
+ test("derives MySQL connection and credential fields from the schema", () => {
+ const mysql = byType.get(PamAccountType.MySQL);
+ expect(mysql).toBeDefined();
+ expect(mysql?.name).toBe("MySQL");
+
+ expect(mysql?.connectionFields.map((f) => f.key)).toEqual([
+ "host",
+ "port",
+ "database",
+ "sslEnabled",
+ "sslRejectUnauthorized",
+ "sslCertificate"
+ ]);
+ expect(fieldByKey(mysql!.connectionFields, "host")).toMatchObject({ widget: "text", required: true });
+ expect(fieldByKey(mysql!.connectionFields, "port")).toMatchObject({ widget: "number", required: true });
+
+ expect(fieldByKey(mysql!.credentialFields, "username")).toMatchObject({
+ widget: "text",
+ required: true,
+ secret: false
+ });
+ expect(fieldByKey(mysql!.credentialFields, "password")).toMatchObject({
+ widget: "password",
+ secret: true,
+ required: false
+ });
+ });
+
test("flattens the SSH discriminated union into a select plus conditional variant fields", () => {
const ssh = byType.get(PamAccountType.SSH);
expect(ssh).toBeDefined();
diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.ts
index b772b3796d..1f7e37b3b0 100644
--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts
+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts
@@ -47,6 +47,39 @@ export const ACCOUNT_TYPE_CONFIGS = {
}
},
+ [PamAccountType.MySQL]: {
+ name: "MySQL",
+ icon: "MySql.png",
+ connectionDetails: z.object({
+ host: z.string().trim().min(1).max(255),
+ port: z.coerce.number(),
+ database: z.string().trim().min(1).max(64),
+ sslEnabled: z.boolean(),
+ sslRejectUnauthorized: z.boolean(),
+ sslCertificate: z
+ .string()
+ .trim()
+ .transform((v) => v || undefined)
+ .optional()
+ }),
+ credentials: z.object({
+ username: z.string().trim().min(1).max(32),
+ password: z
+ .string()
+ .trim()
+ .max(256)
+ .transform((v) => v || undefined)
+ .optional()
+ }),
+ sanitizedCredentials: z.object({ username: z.string().optional() }),
+ ui: {
+ sslEnabled: { label: "SSL Enabled" },
+ sslRejectUnauthorized: { label: "Reject Unauthorized" },
+ sslCertificate: { label: "SSL Certificate", widget: PamFieldWidget.Textarea },
+ password: { widget: PamFieldWidget.Password, secret: true }
+ }
+ },
+
[PamAccountType.SSH]: {
name: "SSH",
icon: "SSH.png",
@@ -145,6 +178,7 @@ export const extractGatewayTarget = (
switch (accountType) {
case PamAccountType.SSH:
case PamAccountType.Postgres:
+ case PamAccountType.MySQL:
return {
host: (validated as { host: string; port: number }).host,
port: (validated as { host: string; port: number }).port