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
Remove service account JSON requirement from GCP Auth
Tuan Dang0a9158690452
diff --git a/backend/src/db/migrations/20240509235819_identity-gcp-auth.ts b/backend/src/db/migrations/20240509235819_identity-gcp-auth.tsindex 2de2750450..8c80fed840 100644--- a/backend/src/db/migrations/20240509235819_identity-gcp-auth.ts+++ b/backend/src/db/migrations/20240509235819_identity-gcp-auth.ts@@ -14,9 +14,6 @@ export async function up(knex: Knex): Promise<void> {t.timestamps(true, true, true);t.uuid("identityId").notNullable().unique();t.foreign("identityId").references("id").inTable(TableName.Identity).onDelete("CASCADE");- t.text("encryptedCredentials").notNullable();- t.string("credentialsIV").notNullable();- t.string("credentialsTag").notNullable();t.string("type").notNullable();t.string("allowedServiceAccounts").notNullable();t.string("allowedProjects").notNullable();diff --git a/backend/src/db/schemas/identity-gcp-auths.ts b/backend/src/db/schemas/identity-gcp-auths.tsindex 5eda85463b..65c7db837d 100644--- a/backend/src/db/schemas/identity-gcp-auths.ts+++ b/backend/src/db/schemas/identity-gcp-auths.ts@@ -16,9 +16,6 @@ export const IdentityGcpAuthsSchema = z.object({createdAt: z.date(),updatedAt: z.date(),identityId: z.string().uuid(),- encryptedCredentials: z.string(),- credentialsIV: z.string(),- credentialsTag: z.string(),type: z.string(),allowedServiceAccounts: z.string(),allowedProjects: z.string(),diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 5eb46e861f..57d78778ef 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -711,7 +711,6 @@ export const registerRoutes = async (identityOrgMembershipDAL,identityAccessTokenDAL,identityDAL,- orgBotDAL,permissionService,licenseService});diff --git a/backend/src/server/routes/v1/identity-gcp-auth-router.ts b/backend/src/server/routes/v1/identity-gcp-auth-router.tsindex 2f7b0240cd..58654f2200 100644--- a/backend/src/server/routes/v1/identity-gcp-auth-router.ts+++ b/backend/src/server/routes/v1/identity-gcp-auth-router.ts@@ -1,14 +1,12 @@import { z } from "zod";+import { IdentityGcpAuthsSchema } from "@app/db/schemas";import { EventType } from "@app/ee/services/audit-log/audit-log-types";import { readLimit, writeLimit } from "@app/server/config/rateLimiter";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { AuthMode } from "@app/services/auth/auth-type";import { TIdentityTrustedIp } from "@app/services/identity/identity-types";-import {- ModifiedIdentityGcpAuthsSchema,- validateGcpAuthField-} from "@app/services/identity-gcp-auth/identity-gcp-auth-validators";+import { validateGcpAuthField } from "@app/services/identity-gcp-auth/identity-gcp-auth-validators";export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider) => {server.route({@@ -76,7 +74,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)identityId: z.string().trim()}),body: z.object({- credentials: z.string().trim(),type: z.enum(["iam", "gce"]),allowedServiceAccounts: validateGcpAuthField,allowedProjects: validateGcpAuthField,@@ -107,7 +104,7 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)}),response: {200: z.object({- identityGcpAuth: ModifiedIdentityGcpAuthsSchema+ identityGcpAuth: IdentityGcpAuthsSchema})}},@@ -162,7 +159,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)identityId: z.string().trim()}),body: z.object({- credentials: z.string().trim().optional(),type: z.enum(["iam", "gce"]).optional(),allowedServiceAccounts: validateGcpAuthField,allowedProjects: validateGcpAuthField,@@ -186,7 +182,7 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)}),response: {200: z.object({- identityGcpAuth: ModifiedIdentityGcpAuthsSchema+ identityGcpAuth: IdentityGcpAuthsSchema})}},@@ -242,7 +238,7 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)}),response: {200: z.object({- identityGcpAuth: ModifiedIdentityGcpAuthsSchema+ identityGcpAuth: IdentityGcpAuthsSchema})}},diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-fns.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-fns.tsindex ad3095b713..16ad991ca7 100644--- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-fns.ts+++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-fns.ts@@ -1,6 +1,5 @@import axios from "axios";-import { JWTInput, OAuth2Client } from "google-auth-library";-import { google } from "googleapis";+import { OAuth2Client } from "google-auth-library";import jwt from "jsonwebtoken";import { UnauthorizedError } from "@app/lib/errors";@@ -8,45 +7,13 @@ import { UnauthorizedError } from "@app/lib/errors";import { TDecodedGcpIamAuthJwt, TGcpGceIdTokenPayload } from "./identity-gcp-auth-types";/**- * Return the full details of the service account corresponding to the service account email or unique ID [serviceAccount].- * @param {string} serviceAccount - The email or unique ID of the service account.- * @param {string} credentials - The credentials in the GCP Auth configuration for Infisical.- * @returns- */-const getGcpServiceAccountDetails = async (serviceAccount: string, credentials: string) => {- const auth = new google.auth.GoogleAuth({- credentials: JSON.parse(credentials) as JWTInput,- scopes: ["https://www.googleapis.com/auth/iam"]- });-- const iam = google.iam({- version: "v1",- auth- });-- const { data } = await iam.projects.serviceAccounts.get({- name: `projects/-/serviceAccounts/${serviceAccount}`- });-- return data;-};--/**- * Validates that the identity token [jwt] sent in from a client GCE instance as part of GCP GCE authentication+ * Validates that the identity token [jwt] sent in from a client GCE instance as part of GCP ID Token authentication* is valid.* @param {string} identityId - The ID of the identity in Infisical that is being authenticated against (used as audience).* @param {string} jwt - The identity token to validate.* @param {string} credentials - The credentials in the GCP Auth configuration for Infisical.*/-export const validateGceIdentity = async ({- identityId,- jwt: identityToken,- credentials-}: {- identityId: string;- jwt: string;- credentials: string;-}) => {+export const validateGceIdentity = async ({ identityId, jwt: identityToken }: { identityId: string; jwt: string }) => {const oAuth2Client = new OAuth2Client();const response = await oAuth2Client.getFederatedSignonCerts();const ticket = await oAuth2Client.verifySignedJwtWithCertsAsync(@@ -57,9 +24,8 @@ export const validateGceIdentity = async ({);const payload = ticket.getPayload() as TGcpGceIdTokenPayload;if (!payload || !payload.email) throw new UnauthorizedError();- const serviceAccountDetails = await getGcpServiceAccountDetails(payload.email, credentials);- return { serviceAccountDetails, gceInstanceDetails: payload };+ return { email: payload.email, computeEngineDetails: payload.google?.compute_engine };};/**@@ -71,12 +37,10 @@ export const validateGceIdentity = async ({*/export const validateIamIdentity = async ({identityId,- jwt: serviceAccountJwt,- credentials+ jwt: serviceAccountJwt}: {identityId: string;jwt: string;- credentials: string;}) => {const decodedJwt = jwt.decode(serviceAccountJwt, { complete: true }) as TDecodedGcpIamAuthJwt;const { sub, aud } = decodedJwt.payload;@@ -96,6 +60,5 @@ export const validateIamIdentity = async ({});if (aud !== identityId) throw new UnauthorizedError();- const serviceAccountDetails = await getGcpServiceAccountDetails(sub, credentials);- return { serviceAccountDetails };+ return { email: sub };};diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.tsindex e2fb373868..8c4fa8b492 100644--- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts+++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts@@ -1,23 +1,13 @@import { ForbiddenError } from "@casl/ability";-import { iam_v1 } from "googleapis";import jwt from "jsonwebtoken";-import { IdentityAuthMethod, SecretKeyEncoding, TIdentityGcpAuthsUpdate } from "@app/db/schemas";+import { IdentityAuthMethod } from "@app/db/schemas";import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";import { getConfig } from "@app/lib/config/env";-import {- decryptSymmetric,- encryptSymmetric,- generateAsymmetricKeyPair,- generateSymmetricKey,- infisicalSymmetricDecrypt,- infisicalSymmetricEncypt-} from "@app/lib/crypto/encryption";import { BadRequestError, UnauthorizedError } from "@app/lib/errors";import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip";-import { TOrgBotDALFactory } from "@app/services/org/org-bot-dal";import { AuthTokenType } from "../auth/auth-type";import { TIdentityDALFactory } from "../identity/identity-dal";@@ -28,7 +18,7 @@ import { TIdentityGcpAuthDALFactory } from "./identity-gcp-auth-dal";import { validateGceIdentity, validateIamIdentity } from "./identity-gcp-auth-fns";import {TAttachGcpAuthDTO,- TGcpGceIdTokenPayload,+ TGcpIdentityDetails,TGetGcpAuthDTO,TLoginGcpAuthDTO,TUpdateGcpAuthDTO@@ -39,7 +29,6 @@ type TIdentityGcpAuthServiceFactoryDep = {identityOrgMembershipDAL: Pick<TIdentityOrgDALFactory, "findOne">;identityAccessTokenDAL: Pick<TIdentityAccessTokenDALFactory, "create">;identityDAL: Pick<TIdentityDALFactory, "updateById">;- orgBotDAL: Pick<TOrgBotDALFactory, "findOne" | "create" | "transaction">;permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;licenseService: Pick<TLicenseServiceFactory, "getPlan">;};@@ -51,7 +40,6 @@ export const identityGcpAuthServiceFactory = ({identityOrgMembershipDAL,identityAccessTokenDAL,identityDAL,- orgBotDAL,permissionService,licenseService}: TIdentityGcpAuthServiceFactoryDep) => {@@ -62,47 +50,20 @@ export const identityGcpAuthServiceFactory = ({const identityMembershipOrg = await identityOrgMembershipDAL.findOne({ identityId: identityGcpAuth.identityId });if (!identityMembershipOrg) throw new UnauthorizedError();- const orgBot = await orgBotDAL.findOne({ orgId: identityMembershipOrg.orgId });- if (!orgBot) throw new BadRequestError({ message: "Org bot not found", name: "OrgBotNotFound" });-- const key = infisicalSymmetricDecrypt({- ciphertext: orgBot.encryptedSymmetricKey,- iv: orgBot.symmetricKeyIV,- tag: orgBot.symmetricKeyTag,- keyEncoding: orgBot.symmetricKeyKeyEncoding as SecretKeyEncoding- });-- const { encryptedCredentials, credentialsIV, credentialsTag } = identityGcpAuth;- let credentials = "";- if (encryptedCredentials && credentialsIV && credentialsTag) {- credentials = decryptSymmetric({- ciphertext: encryptedCredentials,- key,- tag: credentialsTag,- iv: credentialsIV- });- }-- let serviceAccountDetails: iam_v1.Schema$ServiceAccount;- let gceInstanceDetails: TGcpGceIdTokenPayload | undefined;+ let gcpIdentityDetails: TGcpIdentityDetails;switch (identityGcpAuth.type) {case "gce": {- const gceIdentity = await validateGceIdentity({+ gcpIdentityDetails = await validateGceIdentity({identityId,- jwt: serviceAccountJwt,- credentials+ jwt: serviceAccountJwt});- serviceAccountDetails = gceIdentity.serviceAccountDetails;- gceInstanceDetails = gceIdentity.gceInstanceDetails;break;}case "iam": {- const iamIdentity = await validateIamIdentity({+ gcpIdentityDetails = await validateIamIdentity({identityId,- jwt: serviceAccountJwt,- credentials+ jwt: serviceAccountJwt});- serviceAccountDetails = iamIdentity.serviceAccountDetails;break;}default: {@@ -116,30 +77,29 @@ export const identityGcpAuthServiceFactory = ({const isServiceAccountAllowed = identityGcpAuth.allowedServiceAccounts.split(",").map((serviceAccount) => serviceAccount.trim())- .some(- (serviceAccount) =>- serviceAccount === serviceAccountDetails.email || serviceAccount === serviceAccountDetails.uniqueId- );+ .some((serviceAccount) => serviceAccount === gcpIdentityDetails.email);if (!isServiceAccountAllowed) throw new UnauthorizedError();}- if (identityGcpAuth.allowedProjects) {+ // note that only possible to apply allowed projects/zones filters for GCE instances++ if (identityGcpAuth.type === "gce" && identityGcpAuth.allowedProjects && gcpIdentityDetails.computeEngineDetails) {// validate if the project that the service account belongs to is in the list of allowed projectsconst isProjectAllowed = identityGcpAuth.allowedProjects.split(",").map((project) => project.trim())- .some((project) => project === serviceAccountDetails.projectId);+ .some((project) => project === gcpIdentityDetails.computeEngineDetails?.project_id);if (!isProjectAllowed) throw new UnauthorizedError();}- if (identityGcpAuth.type === "gce" && gceInstanceDetails && identityGcpAuth.allowedZones) {+ if (identityGcpAuth.type === "gce" && identityGcpAuth.allowedZones && gcpIdentityDetails.computeEngineDetails) {const isZoneAllowed = identityGcpAuth.allowedZones.split(",").map((zone) => zone.trim())- .some((zone) => zone === gceInstanceDetails!.google.compute_engine.zone);+ .some((zone) => zone === gcpIdentityDetails.computeEngineDetails?.zone);if (!isZoneAllowed) throw new UnauthorizedError();}@@ -180,7 +140,6 @@ export const identityGcpAuthServiceFactory = ({const attachGcpAuth = async ({identityId,- credentials,type,allowedServiceAccounts,allowedProjects,@@ -232,60 +191,6 @@ export const identityGcpAuthServiceFactory = ({return extractIPDetails(accessTokenTrustedIp.ipAddress);});- const orgBot = await orgBotDAL.transaction(async (tx) => {- const doc = await orgBotDAL.findOne({ orgId: identityMembershipOrg.orgId }, tx);- if (doc) return doc;-- const { privateKey, publicKey } = generateAsymmetricKeyPair();- const key = generateSymmetricKey();- const {- ciphertext: encryptedPrivateKey,- iv: privateKeyIV,- tag: privateKeyTag,- encoding: privateKeyKeyEncoding,- algorithm: privateKeyAlgorithm- } = infisicalSymmetricEncypt(privateKey);- const {- ciphertext: encryptedSymmetricKey,- iv: symmetricKeyIV,- tag: symmetricKeyTag,- encoding: symmetricKeyKeyEncoding,- algorithm: symmetricKeyAlgorithm- } = infisicalSymmetricEncypt(key);-- return orgBotDAL.create(- {- name: "Infisical org bot",- publicKey,- privateKeyIV,- encryptedPrivateKey,- symmetricKeyIV,- symmetricKeyTag,- encryptedSymmetricKey,- symmetricKeyAlgorithm,- orgId: identityMembershipOrg.orgId,- privateKeyTag,- privateKeyAlgorithm,- privateKeyKeyEncoding,- symmetricKeyKeyEncoding- },- tx- );- });-- const key = infisicalSymmetricDecrypt({- ciphertext: orgBot.encryptedSymmetricKey,- iv: orgBot.symmetricKeyIV,- tag: orgBot.symmetricKeyTag,- keyEncoding: orgBot.symmetricKeyKeyEncoding as SecretKeyEncoding- });-- const {- ciphertext: encryptedCredentials,- iv: credentialsIV,- tag: credentialsTag- } = encryptSymmetric(credentials, key);-const identityGcpAuth = await identityGcpAuthDAL.transaction(async (tx) => {const doc = await identityGcpAuthDAL.create({@@ -294,9 +199,6 @@ export const identityGcpAuthServiceFactory = ({allowedServiceAccounts,allowedProjects,allowedZones,- encryptedCredentials,- credentialsIV,- credentialsTag,accessTokenMaxTTL,accessTokenTTL,accessTokenNumUsesLimit,@@ -313,13 +215,12 @@ export const identityGcpAuthServiceFactory = ({);return doc;});- return { ...identityGcpAuth, credentials, orgId: identityMembershipOrg.orgId };+ return { ...identityGcpAuth, orgId: identityMembershipOrg.orgId };};const updateGcpAuth = async ({identityId,type,- credentials,allowedServiceAccounts,allowedProjects,allowedZones,@@ -375,7 +276,7 @@ export const identityGcpAuthServiceFactory = ({return extractIPDetails(accessTokenTrustedIp.ipAddress);});- const updateQuery: TIdentityGcpAuthsUpdate = {+ const updatedGcpAuth = await identityGcpAuthDAL.updateById(identityGcpAuth.id, {type,allowedServiceAccounts,allowedProjects,@@ -386,38 +287,10 @@ export const identityGcpAuthServiceFactory = ({accessTokenTrustedIps: reformattedAccessTokenTrustedIps? JSON.stringify(reformattedAccessTokenTrustedIps): undefined- };-- const orgBot = await orgBotDAL.findOne({ orgId: identityMembershipOrg.orgId });- if (!orgBot) throw new BadRequestError({ message: "Org bot not found", name: "OrgBotNotFound" });- const key = infisicalSymmetricDecrypt({- ciphertext: orgBot.encryptedSymmetricKey,- iv: orgBot.symmetricKeyIV,- tag: orgBot.symmetricKeyTag,- keyEncoding: orgBot.symmetricKeyKeyEncoding as SecretKeyEncoding});- if (credentials !== undefined) {- const {- ciphertext: encryptedCredentials,- iv: credentialsIV,- tag: credentialsTag- } = encryptSymmetric(credentials, key);- updateQuery.encryptedCredentials = encryptedCredentials;- updateQuery.credentialsIV = credentialsIV;- updateQuery.credentialsTag = credentialsTag;- }-- const updatedGcpAuth = await identityGcpAuthDAL.updateById(identityGcpAuth.id, updateQuery);-return {...updatedGcpAuth,- credentials: decryptSymmetric({- ciphertext: updatedGcpAuth.encryptedCredentials,- iv: updatedGcpAuth.credentialsIV,- tag: updatedGcpAuth.credentialsTag,- key- }),orgId: identityMembershipOrg.orgId};};@@ -441,28 +314,7 @@ export const identityGcpAuthServiceFactory = ({);ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.Identity);- const orgBot = await orgBotDAL.findOne({ orgId: identityMembershipOrg.orgId });- if (!orgBot) throw new BadRequestError({ message: "Org bot not found", name: "OrgBotNotFound" });-- const key = infisicalSymmetricDecrypt({- ciphertext: orgBot.encryptedSymmetricKey,- iv: orgBot.symmetricKeyIV,- tag: orgBot.symmetricKeyTag,- keyEncoding: orgBot.symmetricKeyKeyEncoding as SecretKeyEncoding- });-- const { encryptedCredentials, credentialsIV, credentialsTag } = identityGcpAuth;- let credentials = "";- if (encryptedCredentials && credentialsIV && credentialsTag) {- credentials = decryptSymmetric({- ciphertext: encryptedCredentials,- key,- tag: credentialsTag,- iv: credentialsIV- });- }-- return { ...identityGcpAuth, credentials, orgId: identityMembershipOrg.orgId };+ return { ...identityGcpAuth, orgId: identityMembershipOrg.orgId };};return {diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.tsindex c01ab2edbe..931de78e08 100644--- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts+++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts@@ -7,7 +7,6 @@ export type TLoginGcpAuthDTO = {export type TAttachGcpAuthDTO = {identityId: string;- credentials: string;type: "iam" | "gce";allowedServiceAccounts: string;allowedProjects: string;@@ -20,7 +19,6 @@ export type TAttachGcpAuthDTO = {export type TUpdateGcpAuthDTO = {identityId: string;- credentials?: string;type?: "iam" | "gce";allowedServiceAccounts?: string;allowedProjects?: string;@@ -35,21 +33,28 @@ export type TGetGcpAuthDTO = {identityId: string;} & Omit<TProjectPermission, "projectId">;+type TComputeEngineDetails = {+ instance_creation_timestamp: number;+ instance_id: string;+ instance_name: string;+ project_id: string;+ project_number: number;+ zone: string;+};++export type TGcpIdentityDetails = {+ email: string;+ computeEngineDetails?: TComputeEngineDetails;+};+export type TGcpGceIdTokenPayload = {aud: string;azp: string;email: string;email_verified: boolean;exp: number;- google: {- compute_engine: {- instance_creation_timestamp: number;- instance_id: string;- instance_name: string;- project_id: string;- project_number: number;- zone: string;- };+ google?: {+ compute_engine: TComputeEngineDetails;};iat: number;iss: string;diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-validators.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-validators.tsindex 7e3ac94390..a49cee4174 100644--- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-validators.ts+++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-validators.ts@@ -1,15 +1,5 @@import { z } from "zod";-import { IdentityGcpAuthsSchema } from "@app/db/schemas";--export const ModifiedIdentityGcpAuthsSchema = IdentityGcpAuthsSchema.omit({- encryptedCredentials: true,- credentialsIV: true,- credentialsTag: true-}).extend({- credentials: z.string()-});-export const validateGcpAuthField = z.string().trim()diff --git a/docs/documentation/platform/identities/gcp-auth.mdx b/docs/documentation/platform/identities/gcp-auth.mdxindex b98b1a00c2..7b5e60600f 100644--- a/docs/documentation/platform/identities/gcp-auth.mdx+++ b/docs/documentation/platform/identities/gcp-auth.mdx@@ -3,58 +3,58 @@ title: GCP Authdescription: "Learn how to authenticate with Infisical for services on Google Cloud Platform"----**GCP Auth** is a GCP-native authentication method for GCP resources to access Infisical.+**GCP Auth** is a GCP-native authentication method for GCP resources to access Infisical. It consists of two sub-methods/approaches:+- GCP ID Token Auth: For GCP services including [Compute Engine](https://cloud.google.com/compute/docs/instances/verifying-instance-identity#request_signature), [App Engine standard environment](https://cloud.google.com/appengine/docs/standard/python3/runtime#metadata_server), [App Engine flexible environment](https://cloud.google.com/appengine/docs/flexible/python/runtime#metadata_server), [Cloud Functions](https://cloud.google.com/functions/docs/securing/function-identity#using_the_metadata_server_to_acquire_tokens), [Cloud Run](https://cloud.google.com/run/docs/container-contract#metadata-server), [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/docs/concepts/workload-identity#instance_metadata), and [Cloud Build](https://cloud.google.com/kubernetes-engine/docs/concepts/workload-identity#instance_metadata) to authenticate with Infisical.- GCP IAM Auth: For Google Cloud Platform (GCP) service accounts to authenticate with Infisical.-- GCP GCE Auth: For GCP services including [Compute Engine](https://cloud.google.com/compute/docs/instances/verifying-instance-identity#request_signature), [App Engine standard environment](https://cloud.google.com/appengine/docs/standard/python3/runtime#metadata_server), [App Engine flexible environment](https://cloud.google.com/appengine/docs/flexible/python/runtime#metadata_server), [Cloud Functions](https://cloud.google.com/functions/docs/securing/function-identity#using_the_metadata_server_to_acquire_tokens), [Cloud Run](https://cloud.google.com/run/docs/container-contract#metadata-server), [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/docs/concepts/workload-identity#instance_metadata), and [Cloud Build](https://cloud.google.com/kubernetes-engine/docs/concepts/workload-identity#instance_metadata) to authenticate with Infisical.<Tabs>-<Tab title="GCP IAM Auth">-+ <Tab title="Google ID Token Auth">+## Diagram- The following sequence digram illustrates the GCP IAM Auth workflow for authenticating GCP IAM service accounts with Infisical.+ The following sequence digram illustrates the GCP ID Token Auth workflow for authenticating GCP resources with Infisical.```mermaidsequenceDiagram- participant GCE as Client+ participant GCE as GCP Serviceparticipant Infis as Infisical- participant Google as Cloud IAM+ participant Google as OAuth2 API- Note over GCE,Google: Step 1: Signed JWT Token Generation- GCE->>Google: Request to generate signed JWT token- Google-->>GCE: Return signed JWT token+ Note over GCE,Google: Step 1: Instance Identity Token Retrieval+ GCE->>Google: Request instance identity metadata token+ Google-->>GCE: Return JWT token with RS256 signature- Note over GCE,Infis: Step 2: JWT Token Login Operation- GCE->>Infis: Send signed JWT token to /api/v1/auth/gcp-auth/login- Infis->>Google: Request public key- Google-->>Infis: Return public key+ Note over GCE,Infis: Step 2: Identity Token Login Operation+ GCE->>Infis: Send JWT token to /api/v1/auth/gcp-auth/login+ Infis->>Google: Request OAuth2 certificates+ Google-->>Infis: Return certificates- Note over Infis: Step 3: JWT Token Verification- Note over Infis: Step 4: JWT Property Validation+ Note over Infis: Step 3: Identity Token Verification+ Note over Infis: Step 4: Identity Property ValidationInfis->>GCE: Return short-lived access token- Note over GCE,Infis: Step 5: Access Infisical API with Token+ Note over GCE,Infis: Step 4: Access Infisical API with TokenGCE->>Infis: Make authenticated requests using the short-lived access token```-## Concept+ ## Concept-At a high-level, Infisical authenticates an IAM service account by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed service account) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,+At a high-level, Infisical authenticates a GCP resource by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed GCE instance) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.To be more specific:-1. The client generates a signed JWT token using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt); this is done using the service account credentials associated with the client.-2. The client sends the signed JWT token to Infisical.-3. Infisical verifies the signed JWT token.+1. The client running on a GCP service obtains an [ID token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity for a GCP resource such as a GCE instance or Cloud Function; this is a unique JWT token that includes details about the instance as well as Google's [RS256 signature](https://datatracker.ietf.org/doc/html/rfc7518#section-3.3).+2. The client sends the ID token to Infisical.+3. Infisical verifies the token against Google's [public OAuth2 certificates](https://www.googleapis.com/oauth2/v3/certs).4. Infisical fetches more details about the identity behind the token and checks if it is allowed to authenticate with Infisical based on set criteria.5. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API.<Note>We recommend using one of Infisical's clients like SDKs or the Infisical Agent-to authenticate with Infisical using GCP IAM Auth as they handle the-authentication process including generating the signed JWT token.+to authenticate with Infisical using GCP ID Token Auth as they handle the+authentication process including generating the instance ID token for you.Also, note that Infisical needs network-level access to send requests to the Google Cloud APIas part of the GCP Auth workflow.@@ -64,7 +64,7 @@ as part of the GCP Auth workflow.## GuideIn the following steps, we explore how to create and use identities for your workloads and applications on GCP to-access the Infisical API using the GCP IAM authentication method.+access the Infisical API using the GCP ID Token authentication method.<Steps><Step title="Creating an identity">@@ -81,24 +81,20 @@ access the Infisical API using the GCP IAM authentication method.- Name (required): A friendly name for the identity.- Role (required): A role from the **Organization Roles** tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.- Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP IAM Auth** and set the **Type** to **GCP IAM Auth**.+ Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP Auth** and set the **Type** to **GCP ID Token Auth**.- + Here's some more guidance on each field:- - Service Account JSON: The JSON key file for the GCP service account that will be used by Infisical to look-up other service account details; this service account should have the `iam.serviceAccounts.get` permission that can be found on the `roles/iam.serviceAccountKeyAdmin` role.- - Allowed Service Account Emails: A comma-separated list of trusted IAM service account emails that are allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.- - Allowed Projects: A comma-separated list of trusted GCP projects that the IAM service accounts must belong to authenticate with Infisical.+ - Allowed Service Account Emails: A comma-separated list of trusted service account emails corresponding to the GCE resource(s) allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.+ - Allowed Projects: A comma-separated list of trusted GCP projects that the GCE instance must belong to authenticate with Infisical. Note that this validation property will only work for GCE instances.+ - Allowed Zones: A comma-separated list of trusted zones that the GCE instances must belong to authenticate with Infisical; this should be the fully-qualified zone name in the format `<region>-<zone>`like `us-central1-a`, `us-west1-b`, etc. Note that this validation property will only work for GCE instances.- Access Token TTL (default is `2592000` equivalent to 30 days): The lifetime for an acccess token in seconds. This value will be referenced at renewal time.- Access Token Max TTL (default is `2592000` equivalent to 30 days): The maximum lifetime for an acccess token in seconds. This value will be referenced at renewal time.- Access Token Max Number of Uses (default is `0`): The maximum number of times that an access token can be used; a value of `0` implies infinite number of uses.- Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address.- <Info>- Note that you should enable the [IAM Service Account Credentials API](https://console.developers.google.com/apis/api/iamcredentials.googleapis.com/overview)- in your project.- </Info></Step><Step title="Adding an identity to a project">To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project.@@ -112,47 +108,30 @@ access the Infisical API using the GCP IAM authentication method.</Step><Step title="Accessing the Infisical API with the identity">- To access the Infisical API as the identity, you need to generate a signed JWT token using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt) and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the signed JWT token in exchange for an access token.-- <Info>- Make sure that the service account has the `iam.serviceAccounts.signJwt` permission or the `roles/iam.serviceAccountTokenCreator` role.- </Info>+ To access the Infisical API as the identity, you need to generate an [ID token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity of the present GCE instance and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the token in exchange for an access token.We provide a few code examples below of how you can authenticate with Infisical to access the [Infisical API](/api-reference/overview/introduction).<AccordionGroup><Accordion- title="Sample code for generating a signed JWT token"+ title="Sample code for generating the ID token">- The following code provides a generic example of how you can generate a signed JWT token against the `projects.serviceAccounts.signJwt` API method.-- The shown example uses Node.js and the official [google-auth-library](https://github.com/googleapis/google-auth-library-nodejs#readme) package but you can use any language you wish.--- ```javascript- const { GoogleAuth } = require("google-auth-library");-- const auth = new GoogleAuth({- scopes: "https://www.googleapis.com/auth/cloud-platform",- });-- const credentials = await auth.getCredentials();-- const identityId = "<your-infisical-identity-id>";+ Start by making a request from the GCE instance to obtain the ID token.+ For more examples of how to obtain the token in Java, Go, Node.js, etc. refer to the [official documentation](https://cloud.google.com/docs/authentication/get-id-token#curl).- const jwtPayload = {- sub: credentials.client_email,- aud: identityId,- };+ #### Sample request+ <CodeGroup>+ ```bash curl+ curl -H "Metadata-Flavor: Google" \+ 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=<identityId>'+ ```+ </CodeGroup>- const { data } = await client.request({- url: `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${credentials.client_email}:signJwt`,- method: "POST",- data: { payload: JSON.stringify(jwtPayload) },- });+ <Note>+ Note that you should replace `<identityId>` with the ID of the identity you created in step 1.+ </Note>- const jwt = data.signedJwt // send this jwt to Infisical in the next step- ```+ Next use send the obtained JWT token along to authenticate with Infisical and obtain an access token.#### Sample request@@ -190,53 +169,54 @@ access the Infisical API using the GCP IAM authentication method.</Step></Steps>- </Tab>- <Tab title="Google GCE Auth">+ </Tab>+<Tab title="GCP IAM Auth">+## Diagram- The following sequence digram illustrates the GCP GCE Auth workflow for authenticating a GCE instance with Infisical.+ The following sequence digram illustrates the GCP IAM Auth workflow for authenticating GCP IAM service accounts with Infisical.```mermaidsequenceDiagram- participant GCE as GCP Service+ participant GCE as Clientparticipant Infis as Infisical- participant Google as OAuth2 API+ participant Google as Cloud IAM- Note over GCE,Google: Step 1: Instance Identity Token Retrieval- GCE->>Google: Request instance identity metadata token- Google-->>GCE: Return JWT token with RS256 signature+ Note over GCE,Google: Step 1: Signed JWT Token Generation+ GCE->>Google: Request to generate signed JWT token+ Google-->>GCE: Return signed JWT token- Note over GCE,Infis: Step 2: Identity Token Login Operation- GCE->>Infis: Send JWT token to /api/v1/auth/gcp-auth/login- Infis->>Google: Request OAuth2 certificates- Google-->>Infis: Return certificates+ Note over GCE,Infis: Step 2: JWT Token Login Operation+ GCE->>Infis: Send signed JWT token to /api/v1/auth/gcp-auth/login+ Infis->>Google: Request public key+ Google-->>Infis: Return public key- Note over Infis: Step 3: Identity Token Verification- Note over Infis: Step 4: Identity Property Validation+ Note over Infis: Step 3: JWT Token Verification+ Note over Infis: Step 4: JWT Property ValidationInfis->>GCE: Return short-lived access token- Note over GCE,Infis: Step 4: Access Infisical API with Token+ Note over GCE,Infis: Step 5: Access Infisical API with TokenGCE->>Infis: Make authenticated requests using the short-lived access token```- ## Concept+## Concept-At a high-level, Infisical authenticates a GCE instance by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed GCE instance) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,+At a high-level, Infisical authenticates an IAM service account by verifying its identity and checking that it meets specific requirements (e.g. it is an allowed service account) at the `/api/v1/auth/gcp-auth/login` endpoint. If successful,then Infisical returns a short-lived access token that can be used to make authenticated requests to the Infisical API.To be more specific:-1. The client running on a GCP service obtains an [ID token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity for a GCE instance; this is a unique JWT token that includes details about the instance as well as Google's [RS256 signature](https://datatracker.ietf.org/doc/html/rfc7518#section-3.3).-2. The client sends the ID token to Infisical.-3. Infisical verifies the token against Google's [public OAuth2 certificates](https://www.googleapis.com/oauth2/v3/certs).+1. The client generates a signed JWT token using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt); this is done using the service account credentials associated with the client.+2. The client sends the signed JWT token to Infisical.+3. Infisical verifies the signed JWT token.4. Infisical fetches more details about the identity behind the token and checks if it is allowed to authenticate with Infisical based on set criteria.5. If all is well, Infisical returns a short-lived access token that the client can use to make authenticated requests to the Infisical API.<Note>We recommend using one of Infisical's clients like SDKs or the Infisical Agent-to authenticate with Infisical using GCP GCE Auth as they handle the-authentication process including generating the instance ID token for you.+to authenticate with Infisical using GCP IAM Auth as they handle the+authentication process including generating the signed JWT token.Also, note that Infisical needs network-level access to send requests to the Google Cloud APIas part of the GCP Auth workflow.@@ -246,7 +226,7 @@ as part of the GCP Auth workflow.## GuideIn the following steps, we explore how to create and use identities for your workloads and applications on GCP to-access the Infisical API using the GCP GCE authentication method.+access the Infisical API using the GCP IAM authentication method.<Steps><Step title="Creating an identity">@@ -263,25 +243,18 @@ access the Infisical API using the GCP GCE authentication method.- Name (required): A friendly name for the identity.- Role (required): A role from the **Organization Roles** tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.- Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP Auth** and set the **Type** to **GCP GCE Auth**.+ Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **GCP IAM Auth** and set the **Type** to **GCP IAM Auth**.- + Here's some more guidance on each field:- - Service Account JSON: The JSON key file for the GCP service account that will be used by Infisical to look-up authenticated service account details.- - Allowed Service Account Emails: A comma-separated list of trusted service account emails corresponding to the GCE instance(s) allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.- - Allowed Projects: A comma-separated list of trusted GCP projects that the GCE instance must belong to authenticate with Infisical.- - Allowed Zones: A comma-separated list of trusted zones that the GCE instances must belong to authenticate with Infisical; this should be the fully-qualified zone name in the format `<region>-<zone>`like `us-central1-a`, `us-west1-b`, etc.+ - Allowed Service Account Emails: A comma-separated list of trusted IAM service account emails that are allowed to authenticate with Infisical; this could be something like `[email protected]`, `[email protected]`, etc.- Access Token TTL (default is `2592000` equivalent to 30 days): The lifetime for an acccess token in seconds. This value will be referenced at renewal time.- Access Token Max TTL (default is `2592000` equivalent to 30 days): The maximum lifetime for an acccess token in seconds. This value will be referenced at renewal time.- Access Token Max Number of Uses (default is `0`): The maximum number of times that an access token can be used; a value of `0` implies infinite number of uses.- Access Token Trusted IPs: The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the `0.0.0.0/0`, allowing usage from any network address.- <Info>- Note that you should enable the [IAM Service Account Credentials API](https://console.developers.google.com/apis/api/iamcredentials.googleapis.com/overview)- in your project.- </Info></Step><Step title="Adding an identity to a project">To enable the identity to access project-level resources such as secrets within a specific project, you should add it to that project.@@ -295,30 +268,47 @@ access the Infisical API using the GCP GCE authentication method.</Step><Step title="Accessing the Infisical API with the identity">- To access the Infisical API as the identity, you need to generate an [ID token](https://cloud.google.com/compute/docs/instances/verifying-instance-identity) constituting the identity of the present GCE instance and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the token in exchange for an access token.+ To access the Infisical API as the identity, you need to generate a signed JWT token using the `projects.serviceAccounts.signJwt` [API method](https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt) and make a request to the `/api/v1/auth/gcp-auth/login` endpoint containing the signed JWT token in exchange for an access token.++ <Info>+ Make sure that the service account has the `iam.serviceAccounts.signJwt` permission or the `roles/iam.serviceAccountTokenCreator` role.+ </Info>We provide a few code examples below of how you can authenticate with Infisical to access the [Infisical API](/api-reference/overview/introduction).<AccordionGroup><Accordion- title="Sample code for generating the ID token"+ title="Sample code for generating a signed JWT token">- Start by making a request from the GCE instance to obtain the ID token.- For more examples of how to obtain the token in Java, Go, Node.js, etc. refer to the [official documentation](https://cloud.google.com/docs/authentication/get-id-token#curl).+ The following code provides a generic example of how you can generate a signed JWT token against the `projects.serviceAccounts.signJwt` API method.- #### Sample request- <CodeGroup>- ```bash curl- curl -H "Metadata-Flavor: Google" \- 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=<identityId>'- ```- </CodeGroup>+ The shown example uses Node.js and the official [google-auth-library](https://github.com/googleapis/google-auth-library-nodejs#readme) package but you can use any language you wish.- <Note>- Note that you should replace `<identityId>` with the ID of the identity you created in step 1.- </Note>- Next use send the obtained JWT token along to authenticate with Infisical and obtain an access token.+ ```javascript+ const { GoogleAuth } = require("google-auth-library");++ const auth = new GoogleAuth({+ scopes: "https://www.googleapis.com/auth/cloud-platform",+ });++ const credentials = await auth.getCredentials();++ const identityId = "<your-infisical-identity-id>";++ const jwtPayload = {+ sub: credentials.client_email,+ aud: identityId,+ };++ const { data } = await client.request({+ url: `https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${credentials.client_email}:signJwt`,+ method: "POST",+ data: { payload: JSON.stringify(jwtPayload) },+ });++ const jwt = data.signedJwt // send this jwt to Infisical in the next step+ ```#### Sample request@@ -356,7 +346,6 @@ access the Infisical API using the GCP GCE authentication method.</Step></Steps>-</Tab></Tabs>diff --git a/docs/images/platform/identities/identities-org-create-gcp-gce-auth-method.png b/docs/images/platform/identities/identities-org-create-gcp-gce-auth-method.pngindex 779c268842..899130c428 100644Binary files a/docs/images/platform/identities/identities-org-create-gcp-gce-auth-method.png and b/docs/images/platform/identities/identities-org-create-gcp-gce-auth-method.png differdiff --git a/docs/images/platform/identities/identities-org-create-gcp-iam-auth-method.png b/docs/images/platform/identities/identities-org-create-gcp-iam-auth-method.pngindex f26e864735..9dacf9f89f 100644Binary files a/docs/images/platform/identities/identities-org-create-gcp-iam-auth-method.png and b/docs/images/platform/identities/identities-org-create-gcp-iam-auth-method.png differdiff --git a/frontend/src/hooks/api/identities/mutations.tsx b/frontend/src/hooks/api/identities/mutations.tsxindex 527f74f160..5c2e20ff0f 100644--- a/frontend/src/hooks/api/identities/mutations.tsx+++ b/frontend/src/hooks/api/identities/mutations.tsx@@ -181,7 +181,6 @@ export const useAddIdentityGcpAuth = () => {return useMutation<IdentityGcpAuth, {}, AddIdentityGcpAuthDTO>({mutationFn: async ({identityId,- credentials,type,allowedServiceAccounts,allowedProjects,@@ -196,7 +195,6 @@ export const useAddIdentityGcpAuth = () => {} = await apiRequest.post<{ identityGcpAuth: IdentityGcpAuth }>(`/api/v1/auth/gcp-auth/identities/${identityId}`,{- credentials,type,allowedServiceAccounts,allowedProjects,@@ -221,7 +219,6 @@ export const useUpdateIdentityGcpAuth = () => {return useMutation<IdentityGcpAuth, {}, UpdateIdentityGcpAuthDTO>({mutationFn: async ({identityId,- credentials,type,allowedServiceAccounts,allowedProjects,@@ -236,7 +233,6 @@ export const useUpdateIdentityGcpAuth = () => {} = await apiRequest.patch<{ identityGcpAuth: IdentityGcpAuth }>(`/api/v1/auth/gcp-auth/identities/${identityId}`,{- credentials,type,allowedServiceAccounts,allowedProjects,diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.tsindex a630965625..c1d8e09fa2 100644--- a/frontend/src/hooks/api/identities/types.ts+++ b/frontend/src/hooks/api/identities/types.ts@@ -115,7 +115,6 @@ export type UpdateIdentityUniversalAuthDTO = {export type IdentityGcpAuth = {identityId: string;- credentials: string;type: "iam" | "gce";allowedServiceAccounts: string;allowedProjects: string;@@ -129,7 +128,6 @@ export type IdentityGcpAuth = {export type AddIdentityGcpAuthDTO = {organizationId: string;identityId: string;- credentials: string;type: "iam" | "gce";allowedServiceAccounts: string;allowedProjects: string;@@ -145,7 +143,6 @@ export type AddIdentityGcpAuthDTO = {export type UpdateIdentityGcpAuthDTO = {organizationId: string;identityId: string;- credentials?: string;type?: "iam" | "gce";allowedServiceAccounts?: string;allowedProjects?: string;diff --git a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsx b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsxindex ecfac5f451..430115d353 100644--- a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsx+++ b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsx@@ -6,15 +6,7 @@ import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";import { createNotification } from "@app/components/notifications";-import {- Button,- FormControl,- IconButton,- Input,- Select,- SelectItem,- TextArea-} from "@app/components/v2";+import { Button, FormControl, IconButton, Input, Select, SelectItem } from "@app/components/v2";import { useOrganization, useSubscription } from "@app/context";import {useAddIdentityGcpAuth,@@ -27,7 +19,6 @@ import { UsePopUpState } from "@app/hooks/usePopUp";const schema = z.object({- credentials: z.string(),type: z.enum(["iam", "gce"]),allowedServiceAccounts: z.string(),allowedProjects: z.string(),@@ -83,8 +74,7 @@ export const IdentityGcpAuthForm = ({} = useForm<FormData>({resolver: zodResolver(schema),defaultValues: {- credentials: "",- type: "iam",+ type: "gce",allowedServiceAccounts: "",allowedProjects: "",allowedZones: "",@@ -106,7 +96,6 @@ export const IdentityGcpAuthForm = ({useEffect(() => {if (data) {reset({- credentials: data.credentials,type: data.type,allowedServiceAccounts: data.allowedServiceAccounts,allowedProjects: data.allowedProjects,@@ -137,7 +126,6 @@ export const IdentityGcpAuthForm = ({}, [data]);const onFormSubmit = async ({- credentials,type,allowedServiceAccounts,allowedProjects,@@ -154,7 +142,6 @@ export const IdentityGcpAuthForm = ({await updateMutateAsync({identityId: identityAuthMethodData.identityId,organizationId: orgId,- credentials,type,allowedServiceAccounts,allowedProjects,@@ -168,7 +155,6 @@ export const IdentityGcpAuthForm = ({await addMutateAsync({identityId: identityAuthMethodData.identityId,organizationId: orgId,- credentials,type,allowedServiceAccounts: allowedServiceAccounts || "",allowedProjects: allowedProjects || "",@@ -211,36 +197,23 @@ export const IdentityGcpAuthForm = ({onValueChange={(e) => onChange(e)}className="w-full">+ <SelectItem value="gce" key="gcp-type-gce">+ GCP ID Token Auth (Recommended)+ </SelectItem><SelectItem value="iam" key="gcpiam">GCP IAM Auth</SelectItem>- <SelectItem value="gce" key="gcp-type-gce">- GCP GCE Auth- </SelectItem></Select></FormControl>)}/>- <Controller- control={control}- name="credentials"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Service Account JSON"- errorText={error?.message}- isError={Boolean(error)}- >- <TextArea {...field} placeholder="" />- </FormControl>- )}- /><Controllercontrol={control}defaultValue="2592000"name="allowedServiceAccounts"render={({ field, fieldState: { error } }) => (<FormControl- label="Allowed Service Accounts"+ label="Allowed Service Account Emails"isError={Boolean(error)}errorText={error?.message}>@@ -252,15 +225,21 @@ export const IdentityGcpAuthForm = ({</FormControl>)}/>- <Controller- control={control}- name="allowedProjects"- render={({ field, fieldState: { error } }) => (- <FormControl label="Allowed Projects" isError={Boolean(error)} errorText={error?.message}>- <Input {...field} placeholder="my-gcp-project, ..." />- </FormControl>- )}- />+ {watchedType === "gce" && (+ <Controller+ control={control}+ name="allowedProjects"+ render={({ field, fieldState: { error } }) => (+ <FormControl+ label="Allowed Projects"+ isError={Boolean(error)}+ errorText={error?.message}+ >+ <Input {...field} placeholder="my-gcp-project, ..." />+ </FormControl>+ )}+ />+ )}{watchedType === "gce" && (<Controllercontrol={control}