Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Rename GcpIam to GcpServiceAccount, fix tooltip/options in discriminated unions
bernie-gc67cff71f87a
diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.tsindex 35c6c85ad1..68233dd6ed 100644--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts@@ -7,7 +7,7 @@ import { z } from "zod";import { BadRequestError } from "@app/lib/errors";-import { GcpIamAuthMethod, PamAccountType } from "../pam/pam-enums";+import { GcpServiceAccountAuthMethod, PamAccountType } from "../pam/pam-enums";import { getApplicablePolicies, PamPolicyDescriptorSchema } from "../pam/pam-policies";import {PamAccountSettingsOverridesSchema,@@ -387,8 +387,8 @@ export const ACCOUNT_TYPE_CONFIGS = {}},- [PamAccountType.GcpIam]: {- name: "GCP Service Account",+ [PamAccountType.GcpServiceAccount]: {+ name: "Google Service Account",icon: "Google Cloud Platform.png",connectionDetails: z.object({serviceAccountEmail: z@@ -403,10 +403,10 @@ export const ACCOUNT_TYPE_CONFIGS = {}),credentials: z.discriminatedUnion("authMethod", [z.object({- authMethod: z.literal(GcpIamAuthMethod.Impersonation)+ authMethod: z.literal(GcpServiceAccountAuthMethod.Impersonation)}),z.object({- authMethod: z.literal(GcpIamAuthMethod.StaticKey),+ authMethod: z.literal(GcpServiceAccountAuthMethod.StaticKey),serviceAccountKeyJson: z.string().trim()@@ -429,15 +429,18 @@ export const ACCOUNT_TYPE_CONFIGS = {authMethod: z.string()}),ui: {- serviceAccountEmail: { label: "Service Account Email" },+ serviceAccountEmail: {+ label: "Service Account Email",+ tooltip: "The email address of the GCP service account to broker access to (must end in .iam.gserviceaccount.com)."+ },authMethod: {label: "Auth Method",tooltip:- "Impersonation uses the platform's GCP identity to generate short-lived tokens for the target service account. Static Key uses a service account key JSON stored directly in the PAM account.",- defaultValue: GcpIamAuthMethod.Impersonation,+ "Impersonation uses the platform's GCP identity to generate short-lived tokens for the target service account.\nStatic Key uses a service account key JSON stored directly in the PAM account.",+ defaultValue: GcpServiceAccountAuthMethod.Impersonation,options: [- { label: "Impersonation (Recommended)", value: GcpIamAuthMethod.Impersonation },- { label: "Static Key", value: GcpIamAuthMethod.StaticKey }+ { label: "Impersonation (Recommended)", value: GcpServiceAccountAuthMethod.Impersonation },+ { label: "Static Key", value: GcpServiceAccountAuthMethod.StaticKey }]},serviceAccountKeyJson: {@@ -656,7 +659,7 @@ export const extractGatewayTarget = async (host: (validated as { hosts: string[]; rdpPort: number }).hosts[0],port: (validated as { hosts: string[]; rdpPort: number }).rdpPort};- case PamAccountType.GcpIam:+ case PamAccountType.GcpServiceAccount:return { host: "googleapis.com", port: 443 };case PamAccountType.AwsIam:throw new Error("AWS IAM accounts do not use gateway routing");@@ -882,8 +885,8 @@ const describeField = (widget,required,secret: hint.secret ?? widget === PamFieldWidget.Password,- ...(widget === PamFieldWidget.Select && enumValues- ? { options: enumValues.map((v) => ({ label: humanizeKey(v), value: v })) }+ ...(widget === PamFieldWidget.Select+ ? { options: hint.options ?? (enumValues ? enumValues.map((v) => ({ label: humanizeKey(v), value: v })) : []) }: {}),...(hint.defaultValue !== undefined ? { defaultValue: hint.defaultValue } : {}),...(resolvedShowWhen ? { showWhen: resolvedShowWhen } : {}),@@ -918,14 +921,17 @@ const fieldsFromSchema = (schema: z.ZodTypeAny, ui: Record<string, TFieldUiHint>const discriminatorValues = variants.map((variant) => (variant.shape[discriminator]._def as { value: string }).value);+ const discHint = ui[discriminator] ?? {};const fields: PamFieldDescriptor[] = [{key: discriminator,- label: ui[discriminator]?.label ?? humanizeKey(discriminator),+ label: discHint.label ?? humanizeKey(discriminator),widget: PamFieldWidget.Select,required: true,secret: false,- options: ui[discriminator]?.options ?? discriminatorValues.map((v) => ({ label: humanizeKey(v), value: v }))+ options: discHint.options ?? discriminatorValues.map((v) => ({ label: humanizeKey(v), value: v })),+ ...(discHint.defaultValue !== undefined ? { defaultValue: discHint.defaultValue } : {}),+ ...(discHint.tooltip ? { tooltip: discHint.tooltip } : {})}];diff --git a/backend/src/ee/services/pam-project/pam-project-bootstrap.ts b/backend/src/ee/services/pam-project/pam-project-bootstrap.tsindex 9520c20acc..5680c76f59 100644--- a/backend/src/ee/services/pam-project/pam-project-bootstrap.ts+++ b/backend/src/ee/services/pam-project/pam-project-bootstrap.ts@@ -150,8 +150,8 @@ export const DEFAULT_ACCOUNT_TEMPLATES: TDefaultTemplate[] = [}},{- name: "gcp-iam",- type: PamAccountType.GcpIam,+ name: "gcp-service-account",+ type: PamAccountType.GcpServiceAccount,settings: {recordingEnabled: true,recordingStorageBackend: PamRecordingStorageBackend.Postgresdiff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex 89ed72b601..8f9fa8ca84 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -24,7 +24,7 @@ import { TMfaSessionServiceFactory } from "@app/services/mfa-session/mfa-sessionimport { TOrgDALFactory } from "@app/services/org/org-dal";import { TUserDALFactory } from "@app/services/user/user-dal";-import { GcpIamAuthMethod, PamAccessMethod, PamAccountType, PamSessionStatus } from "../pam/pam-enums";+import { GcpServiceAccountAuthMethod, PamAccessMethod, PamAccountType, PamSessionStatus } from "../pam/pam-enums";import { enforceMfa } from "../pam/pam-mfa";import {checkAccountAccess,@@ -220,13 +220,13 @@ export const pamSessionServiceFactory = ({}}- if (account.accountType === PamAccountType.GcpIam) {+ if (account.accountType === PamAccountType.GcpServiceAccount) {const serviceAccountEmail = connectionDetails.serviceAccountEmail as string;const remainingSeconds = Math.max(1, Math.floor((new Date(session.expiresAt).getTime() - Date.now()) / 1000));const sessionTtlSeconds = Math.min(remainingSeconds, 3600);let sourceClient;- if (credentials.authMethod === GcpIamAuthMethod.StaticKey) {+ if (credentials.authMethod === GcpServiceAccountAuthMethod.StaticKey) {const keyJson = JSON.parse(credentials.serviceAccountKeyJson as string) as {client_email: string;private_key: string;@@ -624,7 +624,7 @@ export const pamSessionServiceFactory = ({const metadata: Record<string, string> = {};- if (account.accountType === PamAccountType.GcpIam) {+ if (account.accountType === PamAccountType.GcpServiceAccount) {metadata.serviceAccountEmail = rawConnectionDetails.serviceAccountEmail as string;metadata.authMethod = rawCredentials.authMethod as string;} else if (account.accountType === PamAccountType.Kubernetes) {diff --git a/backend/src/ee/services/pam/pam-enums.ts b/backend/src/ee/services/pam/pam-enums.tsindex d5a447161d..62978fd26c 100644--- a/backend/src/ee/services/pam/pam-enums.ts+++ b/backend/src/ee/services/pam/pam-enums.ts@@ -8,7 +8,7 @@ export enum PamAccountType {Redis = "redis",Kubernetes = "kubernetes",AwsIam = "aws-iam",- GcpIam = "gcp-iam",+ GcpServiceAccount = "gcp-service-account",Windows = "windows",WindowsAd = "windows-ad"}@@ -32,7 +32,7 @@ export enum PamSessionStatus {Terminated = "terminated"}-export enum GcpIamAuthMethod {+export enum GcpServiceAccountAuthMethod {Impersonation = "impersonation",StaticKey = "static-key"}diff --git a/frontend/src/hooks/api/pam/enums.ts b/frontend/src/hooks/api/pam/enums.tsindex 778886a8b4..aecd416856 100644--- a/frontend/src/hooks/api/pam/enums.ts+++ b/frontend/src/hooks/api/pam/enums.ts@@ -8,7 +8,7 @@ export enum PamAccountType {Redis = "redis",Kubernetes = "kubernetes",AwsIam = "aws-iam",- GcpIam = "gcp-iam",+ GcpServiceAccount = "gcp-service-account",Windows = "windows",WindowsAd = "windows-ad"}diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsxindex cc1239d36a..a469a0f24c 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamSchemaFields.tsx@@ -121,7 +121,7 @@ export const PamSchemaFields = ({ control, namePrefix, fields }: Props) => {<TooltipTrigger><Info className="text-muted-foreground ml-1 inline h-3.5 w-3.5" /></TooltipTrigger>- <TooltipContent>{descriptor.tooltip}</TooltipContent>+ <TooltipContent className="whitespace-pre-line">{descriptor.tooltip}</TooltipContent></Tooltip>)}</FieldLabel>@@ -141,7 +141,7 @@ export const PamSchemaFields = ({ control, namePrefix, fields }: Props) => {<TooltipTrigger><Info className="text-muted-foreground ml-1 inline h-3.5 w-3.5" /></TooltipTrigger>- <TooltipContent>{descriptor.tooltip}</TooltipContent>+ <TooltipContent className="whitespace-pre-line">{descriptor.tooltip}</TooltipContent></Tooltip>)}</FieldLabel>