Skip to content

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

refactor(pam): make sanitizedCredentials username required, remove dead maps.ts

bernie-g6a837c190fc5
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 8a49e1da46..924724e45d 100644
--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts
+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts
@@ -47,7 +47,7 @@ export const ACCOUNT_TYPE_CONFIGS = {
.transform((v) => v || undefined)
.optional()
}),
- sanitizedCredentials: z.object({ username: z.string().optional() }),
+ sanitizedCredentials: z.object({ username: z.string() }),
ui: {
port: { defaultValue: 5432 },
sslEnabled: { label: "SSL Enabled" },
@@ -88,7 +88,7 @@ export const ACCOUNT_TYPE_CONFIGS = {
.transform((v) => v || undefined)
.optional()
}),
- sanitizedCredentials: z.object({ username: z.string().optional() }),
+ sanitizedCredentials: z.object({ username: z.string() }),
ui: {
port: { defaultValue: 3306 },
sslEnabled: { label: "SSL Enabled" },
@@ -328,8 +328,8 @@ export const ACCOUNT_TYPE_CONFIGS = {
z.object({ authMethod: z.literal("certificate"), username: z.string().trim().min(1) })
]),
sanitizedCredentials: z.object({
- authMethod: z.string().optional(),
- username: z.string().optional()
+ authMethod: z.string(),
+ username: z.string()
}),
ui: {
port: { defaultValue: 22 },
@@ -401,7 +401,7 @@ export const ACCOUNT_TYPE_CONFIGS = {
domain: z.string().trim().max(255).optional()
}),
sanitizedCredentials: z.object({
- username: z.string().optional(),
+ username: z.string(),
domain: z.string().optional()
}),
ui: {
diff --git a/frontend/src/hooks/api/pam/index.ts b/frontend/src/hooks/api/pam/index.ts
index dda90a234c..f49a872a5a 100644
--- a/frontend/src/hooks/api/pam/index.ts
+++ b/frontend/src/hooks/api/pam/index.ts
@@ -1,5 +1,4 @@
export * from "./enums";
-export * from "./maps";
export * from "./mutations";
export * from "./queries";
export * from "./types";
diff --git a/frontend/src/hooks/api/pam/maps.ts b/frontend/src/hooks/api/pam/maps.ts
deleted file mode 100644
index a517b60183..0000000000
--- a/frontend/src/hooks/api/pam/maps.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { PamAccountType } from "./enums";
-
-export const PAM_ACCOUNT_TYPE_MAP: Record<PamAccountType, { name: string; image: string }> = {
- [PamAccountType.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
- [PamAccountType.MySQL]: { name: "MySQL", image: "MySql.png" },
- [PamAccountType.SSH]: { name: "SSH", image: "SSH.png" },
- [PamAccountType.Kubernetes]: { name: "Kubernetes", image: "Kubernetes.png" },
- [PamAccountType.OracleDB]: { name: "OracleDB", image: "Oracle.png" },
- [PamAccountType.MsSQL]: { name: "Microsoft SQL Server", image: "MsSql.png" },
- [PamAccountType.Redis]: { name: "Redis", image: "Redis.png" },
- [PamAccountType.MongoDB]: { name: "MongoDB", image: "MongoDB.png" },
- [PamAccountType.AwsIam]: { name: "AWS IAM", image: "Amazon Web Services.png" },
- [PamAccountType.Windows]: { name: "Windows", image: "Windows.png" }
-};
-
-const PAM_ACCOUNT_TYPE_FALLBACK = { name: "Unknown", image: "Windows.png" };
-
-export const getPamAccountTypeInfo = (accountType: string): { name: string; image: string } =>
- (PAM_ACCOUNT_TYPE_MAP as Record<string, { name: string; image: string }>)[accountType] ??
- PAM_ACCOUNT_TYPE_FALLBACK;