Skip to content

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

feat(gateway): GCP enrollment

bernie-ged816abfecc8
diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.ts
index ae09541361..20ed4a0e37 100644
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@ -521,6 +521,9 @@ import {
TResourceAwsAuths,
TResourceAwsAuthsInsert,
TResourceAwsAuthsUpdate,
+ TResourceGcpAuths,
+ TResourceGcpAuthsInsert,
+ TResourceGcpAuthsUpdate,
TResourceKubernetesAuths,
TResourceKubernetesAuthsInsert,
TResourceKubernetesAuthsUpdate,
@@ -1735,6 +1738,11 @@ declare module "knex/types/tables" {
TResourceAwsAuthsInsert,
TResourceAwsAuthsUpdate
>;
+ [TableName.ResourceGcpAuth]: KnexOriginal.CompositeTableType<
+ TResourceGcpAuths,
+ TResourceGcpAuthsInsert,
+ TResourceGcpAuthsUpdate
+ >;
[TableName.ResourceKubernetesAuth]: KnexOriginal.CompositeTableType<
TResourceKubernetesAuths,
TResourceKubernetesAuthsInsert,
diff --git a/backend/src/db/migrations/20260915135021_resource-gcp-auth.ts b/backend/src/db/migrations/20260915135021_resource-gcp-auth.ts
new file mode 100644
index 0000000000..2500450f70
--- /dev/null
+++ b/backend/src/db/migrations/20260915135021_resource-gcp-auth.ts
@@ -0,0 +1,27 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
+
+export async function up(knex: Knex): Promise<void> {
+ if (!(await knex.schema.hasTable(TableName.ResourceGcpAuth))) {
+ await knex.schema.createTable(TableName.ResourceGcpAuth, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+ t.uuid("authMethodId").notNullable().unique();
+ t.foreign("authMethodId").references("id").inTable(TableName.ResourceAuthMethod).onDelete("CASCADE");
+ // "gce" verifies a metadata-server ID token, "iam" a service-account-signed JWT.
+ t.string("type", 32).notNullable().defaultTo("gce");
+ t.string("allowedServiceAccounts", 1024).notNullable().defaultTo("");
+ t.string("allowedProjects", 1024).notNullable().defaultTo("");
+ t.string("allowedZones", 1024).notNullable().defaultTo("");
+ t.timestamps(true, true, true);
+ });
+
+ await createOnUpdateTrigger(knex, TableName.ResourceGcpAuth);
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ await dropOnUpdateTrigger(knex, TableName.ResourceGcpAuth);
+ await knex.schema.dropTableIfExists(TableName.ResourceGcpAuth);
+}
diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.ts
index fedb48bf30..820ba5f22d 100644
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@ -207,6 +207,7 @@ export * from "./rate-limit";
export * from "./relays";
export * from "./resource-auth-methods";
export * from "./resource-aws-auths";
+export * from "./resource-gcp-auths";
export * from "./resource-kubernetes-auths";
export * from "./resource-metadata";
export * from "./resource-token-auths";
diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.ts
index 14a451ec95..e93cc74b06 100644
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@ -242,6 +242,7 @@ export enum TableName {
GatewayV2 = "gateways_v2",
ResourceAuthMethod = "resource_auth_methods",
ResourceAwsAuth = "resource_aws_auths",
+ ResourceGcpAuth = "resource_gcp_auths",
ResourceKubernetesAuth = "resource_kubernetes_auths",
ResourceTokenAuth = "resource_token_auths",
GatewayPool = "gateway_pools",
diff --git a/backend/src/db/schemas/resource-gcp-auths.ts b/backend/src/db/schemas/resource-gcp-auths.ts
new file mode 100644
index 0000000000..abb4e56b2c
--- /dev/null
+++ b/backend/src/db/schemas/resource-gcp-auths.ts
@@ -0,0 +1,23 @@
+// Code generated by automation script, DO NOT EDIT.
+// Automated by pulling database and generating zod schema
+// To update. Just run npm run generate:schema
+// Written by akhilmhdh.
+
+import { z } from "zod";
+
+import { TImmutableDBKeys } from "./models";
+
+export const ResourceGcpAuthsSchema = z.object({
+ id: z.string().uuid(),
+ authMethodId: z.string().uuid(),
+ type: z.string().default("gce"),
+ allowedServiceAccounts: z.string().default(""),
+ allowedProjects: z.string().default(""),
+ allowedZones: z.string().default(""),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
+export type TResourceGcpAuths = z.infer<typeof ResourceGcpAuthsSchema>;
+export type TResourceGcpAuthsInsert = Omit<z.input<typeof ResourceGcpAuthsSchema>, TImmutableDBKeys>;
+export type TResourceGcpAuthsUpdate = Partial<Omit<z.input<typeof ResourceGcpAuthsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/ee/routes/v3/gateway-router.ts b/backend/src/ee/routes/v3/gateway-router.ts
index 1963203d62..ca8a172452 100644
--- a/backend/src/ee/routes/v3/gateway-router.ts
+++ b/backend/src/ee/routes/v3/gateway-router.ts
@@ -4,12 +4,18 @@ import { GatewaysV2Schema } from "@app/db/schemas";
import { EventType, UserAgentType } from "@app/ee/services/audit-log/audit-log-types";
import { gatewayTransports } from "@app/ee/services/gateway-v2/gateway-v2-transport-fns";
import { validateAccountIds, validatePrincipalArns } from "@app/ee/services/resource-auth-method/aws-auth-validators";
+import {
+ validateAllowedProjects,
+ validateAllowedServiceAccounts,
+ validateAllowedZones
+} from "@app/ee/services/resource-auth-method/gcp-auth-validators";
import {
validateAllowedNames,
validateAllowedNamespaces,
validateKubernetesHost
} from "@app/ee/services/resource-auth-method/kubernetes-auth-validators";
import {
+ GcpAuthType,
KubernetesTokenReviewMode,
ResourceAuthMethodType
} from "@app/ee/services/resource-auth-method/resource-auth-method-fns";
@@ -65,6 +71,33 @@ const AwsAuthMethodInputSchema = z
path: ["allowedPrincipalArns"]
});
+const GcpAuthMethodInputSchema = z
+ .object({
+ method: z.literal(ResourceAuthMethodType.Gcp),
+ type: z.nativeEnum(GcpAuthType).default(GcpAuthType.Gce).describe(GATEWAYS.AUTH_METHOD.gcpAuthType),
+ allowedServiceAccounts: validateAllowedServiceAccounts.describe(GATEWAYS.AUTH_METHOD.allowedServiceAccounts),
+ allowedProjects: validateAllowedProjects.describe(GATEWAYS.AUTH_METHOD.allowedProjects),
+ allowedZones: validateAllowedZones.describe(GATEWAYS.AUTH_METHOD.allowedZones)
+ })
+ // Zones are deliberately not sufficient on their own: the zone namespace is global, so any GCP
+ // customer can put an instance in us-central1-a and satisfy a zone-only config. Only service
+ // accounts and projects name something inside this organization.
+ .refine(
+ (data) => data.allowedServiceAccounts.trim().length > 0 || data.allowedProjects.trim().length > 0,
+ {
+ message:
+ "At least one of allowedServiceAccounts or allowedProjects must be set. A zone on its own restricts nothing, because any GCP customer can create an instance in a given zone.",
+ path: ["allowedServiceAccounts"]
+ }
+ )
+ // An IAM-signed JWT carries no instance details, so a project or zone allowlist on it would never
+ // be checkable and every login would be refused.
+ .refine((data) => data.type !== GcpAuthType.Iam || (!data.allowedProjects.trim() && !data.allowedZones.trim()), {
+ message:
+ "Allowed projects and zones only apply to the Compute Engine token type. Restrict an IAM service account token by service account instead.",
+ path: ["allowedProjects"]
+ });
+
const KubernetesAuthMethodInputSchema = z
.object({
method: z.literal(ResourceAuthMethodType.Kubernetes),
@@ -123,6 +156,7 @@ const TokenAuthMethodInputSchema = z.object({
// Settable methods only — `identity` is read-only and never accepted as input.
const SettableAuthMethodInputSchema = z.union([
AwsAuthMethodInputSchema,
+ GcpAuthMethodInputSchema,
KubernetesAuthMethodInputSchema,
TokenAuthMethodInputSchema
]);
@@ -141,6 +175,17 @@ const toCreateAuthMethodArg = (input: TSettableAuthMethodInput) => {
}
} as const;
}
+ if (input.method === ResourceAuthMethodType.Gcp) {
+ return {
+ method: ResourceAuthMethodType.Gcp,
+ config: {
+ type: input.type,
+ allowedServiceAccounts: input.allowedServiceAccounts,
+ allowedProjects: input.allowedProjects,
+ allowedZones: input.allowedZones
+ }
+ } as const;
+ }
if (input.method === ResourceAuthMethodType.Kubernetes) {
return {
method: ResourceAuthMethodType.Kubernetes,
@@ -170,6 +215,15 @@ const toSetAuthMethodArg = (input: TSettableAuthMethodInput) => {
allowedAccountIds: input.allowedAccountIds
} as const;
}
+ if (input.method === ResourceAuthMethodType.Gcp) {
+ return {
+ method: ResourceAuthMethodType.Gcp,
+ type: input.type,
+ allowedServiceAccounts: input.allowedServiceAccounts,
+ allowedProjects: input.allowedProjects,
+ allowedZones: input.allowedZones
+ } as const;
+ }
if (input.method === ResourceAuthMethodType.Kubernetes) {
return {
method: ResourceAuthMethodType.Kubernetes,
@@ -296,9 +350,11 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
metadata: {
resourceType: "gateway",
resourceId: req.params.gatewayId,
- method: result.method as "aws" | "kubernetes" | "token",
+ method: result.method as "aws" | "gcp" | "kubernetes" | "token",
methodConfigId:
- result.method === ResourceAuthMethodType.Aws || result.method === ResourceAuthMethodType.Kubernetes
+ result.method === ResourceAuthMethodType.Aws ||
+ result.method === ResourceAuthMethodType.Gcp ||
+ result.method === ResourceAuthMethodType.Kubernetes
? result.config.id
: req.params.gatewayId,
...(result.method === ResourceAuthMethodType.Aws
@@ -308,6 +364,14 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
allowedAccountIds: result.config.allowedAccountIds
}
: {}),
+ ...(result.method === ResourceAuthMethodType.Gcp
+ ? {
+ gcpAuthType: result.config.type,
+ allowedServiceAccounts: result.config.allowedServiceAccounts,
+ allowedProjects: result.config.allowedProjects,
+ allowedZones: result.config.allowedZones
+ }
+ : {}),
...(result.method === ResourceAuthMethodType.Kubernetes
? {
kubernetesHost: result.config.kubernetesHost,
@@ -329,7 +393,7 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
resourceType: "gateway",
resourceId: req.params.gatewayId,
orgId: req.permission.orgId,
- method: result.method as "aws" | "kubernetes" | "token"
+ method: result.method as "aws" | "gcp" | "kubernetes" | "token"
}
})
.catch((err) => {
@@ -396,7 +460,7 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
params: z.object({ gatewayId: z.string().trim().uuid() }),
response: {
200: z.object({
- method: z.enum(["aws", "kubernetes", "token"])
+ method: z.enum(["aws", "gcp", "kubernetes", "token"])
})
}
},
@@ -434,7 +498,7 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
schema: {
operationId: "loginGateway",
tags: [ApiDocsTags.GatewaysV3],
- description: "Gateway login. Body discriminates on `method` for AWS, Kubernetes, or token authentication.",
+ description: "Gateway login. Body discriminates on `method` for AWS, GCP, Kubernetes, or token authentication.",
body: z.discriminatedUnion("method", [
z.object({
method: z.literal(ResourceAuthMethodType.Aws),
@@ -443,6 +507,11 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
iamRequestBody: z.string().describe(GATEWAYS.LOGIN.iamRequestBody),
iamRequestHeaders: z.string().describe(GATEWAYS.LOGIN.iamRequestHeaders)
}),
+ z.object({
+ method: z.literal(ResourceAuthMethodType.Gcp),
+ gatewayId: z.string().trim().uuid().describe(GATEWAYS.LOGIN.gatewayId),
+ jwt: z.string().trim().min(1).max(8192).describe(GATEWAYS.LOGIN.gcpJwt)
+ }),
z.object({
method: z.literal(ResourceAuthMethodType.Kubernetes),
gatewayId: z.string().trim().uuid().describe(GATEWAYS.LOGIN.gatewayId),
@@ -541,6 +610,85 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
}
}
+ if (req.body.method === ResourceAuthMethodType.Gcp) {
+ try {
+ const result = await server.services.resourceAuthMethod.loginWithGcp({
+ resource: { type: "gateway", id: req.body.gatewayId },
+ jwt: req.body.jwt
+ });
+
+ await server.services.auditLog
+ .createAuditLog({
+ orgId: result.orgId,
+ actor: { type: ActorType.GATEWAY, metadata: { gatewayId: result.resourceId } },
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN,
+ metadata: {
+ resourceType: "gateway",
+ resourceId: result.resourceId,
+ method: ResourceAuthMethodType.Gcp,
+ methodConfigId: result.configId,
+ gcpServiceAccountEmail: result.serviceAccountEmail,
+ gcpProjectId: result.projectId,
+ gcpZone: result.zone
+ }
+ },
+ ipAddress: req.ip,
+ userAgent: req.headers["user-agent"] ?? "",
+ userAgentType: UserAgentType.OTHER
+ })
+ .catch(() => {});
+
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.ResourceAuthMethodLogin,
+ distinctId: `gateway-${result.resourceId}`,
+ organizationId: result.orgId,
+ properties: {
+ resourceType: "gateway",
+ resourceId: result.resourceId,
+ orgId: result.orgId,
+ method: ResourceAuthMethodType.Gcp
+ }
+ })
+ .catch((err) => {
+ logger.error(err, `Failed to send telemetry [gatewayId=${result.resourceId}]`);
+ });
+
+ return {
+ accessToken: result.accessToken,
+ gatewayId: result.resourceId,
+ tokenType: "Bearer" as const
+ };
+ } catch (error) {
+ if (error instanceof UnauthorizedError && error.detail?.resourceId) {
+ await server.services.auditLog
+ .createAuditLog({
+ orgId: error.detail.orgId as string,
+ actor: { type: ActorType.GATEWAY, metadata: { gatewayId: error.detail.resourceId as string } },
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN_FAILED,
+ metadata: {
+ resourceType: "gateway",
+ resourceId: error.detail.resourceId as string,
+ method: ResourceAuthMethodType.Gcp,
+ reasonCode: error.detail.reasonCode as string,
+ message: error.message,
+ gcpServiceAccountEmail: error.detail.serviceAccountEmail as string | undefined,
+ gcpProjectId: error.detail.projectId as string | undefined,
+ gcpZone: error.detail.zone as string | undefined
+ }
+ },
+ ipAddress: req.ip,
+ userAgent: req.headers["user-agent"] ?? "",
+ userAgentType: UserAgentType.OTHER
+ })
+ .catch(() => {});
+ }
+ throw error;
+ }
+ }
+
if (req.body.method === ResourceAuthMethodType.Kubernetes) {
try {
const result = await server.services.resourceAuthMethod.loginWithKubernetes({
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 5baca690b6..8db785d8ef 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -7277,7 +7277,7 @@ interface GatewayConnectEvent {
};
}
-type ResourceAuthMethodKind = "aws" | "kubernetes" | "token";
+type ResourceAuthMethodKind = "aws" | "gcp" | "kubernetes" | "token";
type ResourceAuthMethodResourceType = "gateway" | "relay" | "kmip";
interface ResourceAuthMethodLoginEvent {
@@ -7292,6 +7292,9 @@ interface ResourceAuthMethodLoginEvent {
enrollmentTokenId?: string;
kubernetesNamespace?: string;
kubernetesServiceAccountName?: string;
+ gcpServiceAccountEmail?: string;
+ gcpProjectId?: string;
+ gcpZone?: string;
};
}
@@ -7307,6 +7310,9 @@ interface ResourceAuthMethodLoginFailedEvent {
accountId?: string;
kubernetesNamespace?: string;
kubernetesServiceAccountName?: string;
+ gcpServiceAccountEmail?: string;
+ gcpProjectId?: string;
+ gcpZone?: string;
};
}
@@ -7324,6 +7330,10 @@ interface ResourceAuthMethodUpdateEvent {
allowedNamespaces?: string;
allowedNames?: string;
allowedAudience?: string;
+ gcpAuthType?: string;
+ allowedServiceAccounts?: string;
+ allowedProjects?: string;
+ allowedZones?: string;
};
}
diff --git a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
index 227cb3664a..6e8d209bd5 100644
--- a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
+++ b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
@@ -42,7 +42,11 @@ import { TPkiDiscoveryConfigDALFactory } from "../pki-discovery/pki-discovery-co
import { TRelayDALFactory } from "../relay/relay-dal";
import { TRelayServiceFactory } from "../relay/relay-service";
import { TResourceAuthMethodServiceFactory } from "../resource-auth-method/resource-auth-method-service";
-import { TAwsAuthMethodConfig, TKubernetesAuthMethodConfig } from "../resource-auth-method/resource-auth-method-types";
+import {
+ TAwsAuthMethodConfig,
+ TGcpAuthMethodConfig,
+ TKubernetesAuthMethodConfig
+} from "../resource-auth-method/resource-auth-method-types";
import {
DEFAULT_HEARTBEAT_TTL,
GATEWAY_ACTOR_OID,
@@ -1328,6 +1332,7 @@ export const gatewayV2ServiceFactory = ({
name: string;
authMethod:
| { method: "aws"; config: TAwsAuthMethodConfig }
+ | { method: "gcp"; config: TGcpAuthMethodConfig }
| { method: "kubernetes"; config: TKubernetesAuthMethodConfig }
| { method: "token" };
}) => {
diff --git a/backend/src/ee/services/resource-auth-method/gcp-auth-dal.ts b/backend/src/ee/services/resource-auth-method/gcp-auth-dal.ts
new file mode 100644
index 0000000000..0eb8cdf9bd
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/gcp-auth-dal.ts
@@ -0,0 +1,9 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TResourceGcpAuthDALFactory = ReturnType<typeof resourceGcpAuthDALFactory>;
+
+export const resourceGcpAuthDALFactory = (db: TDbClient) => {
+ return ormify(db, TableName.ResourceGcpAuth);
+};
diff --git a/backend/src/ee/services/resource-auth-method/gcp-auth-fns.test.ts b/backend/src/ee/services/resource-auth-method/gcp-auth-fns.test.ts
new file mode 100644
index 0000000000..7f36793bed
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/gcp-auth-fns.test.ts
@@ -0,0 +1,118 @@
+import { UnauthorizedError } from "@app/lib/errors";
+
+import { validateGcpAllowlists } from "./gcp-auth-fns";
+import { GcpAuthType } from "./resource-auth-method-fns";
+
+const SERVICE_ACCOUNT = "[email protected]";
+
+const computeEngineDetails = {
+ instance_creation_timestamp: 0,
+ instance_id: "1",
+ instance_name: "gw",
+ project_id: "my-project",
+ project_number: 1,
+ zone: "us-central1-a"
+};
+
+const validate = (overrides: Partial<Parameters<typeof validateGcpAllowlists>[0]>) =>
+ validateGcpAllowlists({
+ type: GcpAuthType.Gce,
+ identityDetails: { email: SERVICE_ACCOUNT, computeEngineDetails },
+ allowedServiceAccounts: "",
+ allowedProjects: "",
+ allowedZones: "",
+ errorContext: {},
+ ...overrides
+ });
+
+const reasonCodeOf = (fn: () => void) => {
+ try {
+ fn();
+ } catch (err) {
+ if (err instanceof UnauthorizedError) return err.detail?.reasonCode;
+ throw err;
+ }
+ return undefined;
+};
+
+describe("validateGcpAllowlists", () => {
+ test("refuses a config with no allowlist at all", () => {
+ expect(reasonCodeOf(() => validate({}))).toBe("no_allowlist_configured");
+ });
+
+ test("accepts a service account on the allowlist", () => {
+ expect(() =>
+ validate({ allowedServiceAccounts: `[email protected], ${SERVICE_ACCOUNT}` })
+ ).not.toThrow();
+ });
+
+ test("refuses a service account off the allowlist", () => {
+ expect(reasonCodeOf(() => validate({ allowedServiceAccounts: "[email protected]" }))).toBe(
+ "service_account_not_allowed"
+ );
+ });
+
+ // Zone names are a global namespace, so a zone-only config restricts nobody.
+ test("refuses a zone-only config", () => {
+ expect(reasonCodeOf(() => validate({ allowedZones: "us-central1-a" }))).toBe("no_allowlist_configured");
+ });
+
+ test("refuses a zone-only config even when the zone matches", () => {
+ expect(reasonCodeOf(() => validate({ allowedZones: "us-central1-a,europe-west1-b" }))).toBe(
+ "no_allowlist_configured"
+ );
+ });
+
+ test("accepts a zone alongside a service account", () => {
+ expect(() => validate({ allowedServiceAccounts: SERVICE_ACCOUNT, allowedZones: "us-central1-a" })).not.toThrow();
+ });
+
+ test("accepts a matching project and zone", () => {
+ expect(() => validate({ allowedProjects: "my-project", allowedZones: "us-central1-a" })).not.toThrow();
+ });
+
+ test("refuses a project off the allowlist", () => {
+ expect(reasonCodeOf(() => validate({ allowedProjects: "other-project" }))).toBe("project_not_allowed");
+ });
+
+ test("refuses a zone off the allowlist", () => {
+ expect(
+ reasonCodeOf(() => validate({ allowedServiceAccounts: SERVICE_ACCOUNT, allowedZones: "europe-west1-b" }))
+ ).toBe("zone_not_allowed");
+ });
+
+ // A GKE workload identity token carries no compute_engine claim. Skipping the project check
+ // there would authenticate any Google service account against a project-only allowlist.
+ test("refuses a project allowlist when the token carries no Compute Engine details", () => {
+ expect(
+ reasonCodeOf(() =>
+ validate({
+ identityDetails: { email: SERVICE_ACCOUNT },
+ allowedProjects: "my-project"
+ })
+ )
+ ).toBe("compute_engine_details_missing");
+ });
+
+ test("refuses a project allowlist on an IAM-signed token", () => {
+ expect(
+ reasonCodeOf(() =>
+ validate({
+ type: GcpAuthType.Iam,
+ identityDetails: { email: SERVICE_ACCOUNT },
+ allowedProjects: "my-project"
+ })
+ )
+ ).toBe("compute_engine_details_missing");
+ });
+
+ test("accepts an IAM-signed token restricted by service account alone", () => {
+ expect(() =>
+ validate({
+ type: GcpAuthType.Iam,
+ identityDetails: { email: SERVICE_ACCOUNT },
+ allowedServiceAccounts: SERVICE_ACCOUNT
+ })
+ ).not.toThrow();
+ });
+});
diff --git a/backend/src/ee/services/resource-auth-method/gcp-auth-fns.ts b/backend/src/ee/services/resource-auth-method/gcp-auth-fns.ts
new file mode 100644
index 0000000000..bf00e47a98
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/gcp-auth-fns.ts
@@ -0,0 +1,133 @@
+import { UnauthorizedError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { validateIamIdentity, validateIdTokenIdentity } from "@app/services/identity-gcp-auth/identity-gcp-auth-fns";
+import { TGcpIdentityDetails } from "@app/services/identity-gcp-auth/identity-gcp-auth-types";
+
+import { GcpAuthType, ResourceAuthLoginFailureReason, TGcpAuthType } from "./resource-auth-method-fns";
+
+type TVerifyGcpTokenInput = {
+ type: TGcpAuthType;
+ jwt: string;
+ audience: string;
+ errorContext: Record<string, unknown>;
+};
+
+export const verifyGcpTokenAndExtractCaller = async ({
+ type,
+ jwt,
+ audience,
+ errorContext
+}: TVerifyGcpTokenInput): Promise<TGcpIdentityDetails> => {
+ try {
+ if (type === GcpAuthType.Gce) {
+ return await validateIdTokenIdentity({ audience, jwt });
+ }
+ return await validateIamIdentity({ audience, jwt });
+ } catch (err) {
+ logger.error(
+ err,
+ `Resource GCP Auth Login: token verification failed [resourceId=${String(errorContext.resourceId)}]`
+ );
+ throw new UnauthorizedError({
+ message:
+ type === GcpAuthType.Gce
+ ? "Could not verify the GCP identity token. Check that it was issued for this gateway's ID as the audience."
+ : "Could not verify the signed GCP service account token. Check that it was signed for this gateway's ID as the audience.",
+ detail: { reasonCode: ResourceAuthLoginFailureReason.GcpTokenVerificationFailed, ...errorContext }
+ });
+ }
+};
+
+const splitAllowlist = (value: string) =>
+ value
+ .split(",")
+ .map((entry) => entry.trim())
+ .filter((entry) => entry.length > 0);
+
+type TValidateGcpAllowlistsInput = {
+ type: TGcpAuthType;
+ identityDetails: TGcpIdentityDetails;
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ errorContext: Record<string, unknown>;
+};
+
+export const validateGcpAllowlists = ({
+ type,
+ identityDetails,
+ allowedServiceAccounts,
+ allowedProjects,
+ allowedZones,
+ errorContext
+}: TValidateGcpAllowlistsInput) => {
+ const serviceAccounts = splitAllowlist(allowedServiceAccounts);
+ const projects = splitAllowlist(allowedProjects);
+ const zones = splitAllowlist(allowedZones);
+
+ // A zone allowlist is not an allowlist on its own. Zone names are a global namespace, so any GCP
+ // customer can place an instance in one; only a service account or project names something inside
+ // this organization.
+ if (!serviceAccounts.length && !projects.length) {
+ throw new UnauthorizedError({
+ message: zones.length
+ ? "Access denied: GCP auth method restricts only by zone, which any GCP customer can match. Add an allowed service account or project."
+ : "Access denied: GCP auth method has no allowlist configured.",
+ detail: { reasonCode: ResourceAuthLoginFailureReason.NoAllowlistConfigured, ...errorContext }
+ });
+ }
+
+ if (serviceAccounts.length && !serviceAccounts.includes(identityDetails.email)) {
+ throw new UnauthorizedError({
+ message: `Access denied: GCP service account not allowed. [service-account=${identityDetails.email}]`,
+ detail: {
+ reasonCode: ResourceAuthLoginFailureReason.ServiceAccountNotAllowed,
+ serviceAccountEmail: identityDetails.email,
+ ...errorContext
+ }
+ });
+ }
+
+ if (!projects.length && !zones.length) return;
+
+ // A GKE Workload Identity token carries no compute_engine claim, so there is nothing to match a
+ // project or zone against. Skipping the check there would authenticate any service account that
+ // cleared the (possibly empty) service account allowlist.
+ const { computeEngineDetails } = identityDetails;
+ if (type !== GcpAuthType.Gce || !computeEngineDetails) {
+ throw new UnauthorizedError({
+ message:
+ "Access denied: this GCP token carries no Compute Engine instance details, so the allowed projects and zones cannot be verified. Remove those allowlists and restrict by service account instead, or authenticate from a Compute Engine instance.",
+ detail: {
+ reasonCode: ResourceAuthLoginFailureReason.ComputeEngineDetailsMissing,
+ serviceAccountEmail: identityDetails.email,
+ ...errorContext
+ }
+ });
+ }
+
+ if (projects.length && !projects.includes(computeEngineDetails.project_id)) {
+ throw new UnauthorizedError({
+ message: `Access denied: GCP project not allowed. [project=${computeEngineDetails.project_id}]`,
+ detail: {
+ reasonCode: ResourceAuthLoginFailureReason.ProjectNotAllowed,
+ serviceAccountEmail: identityDetails.email,
+ projectId: computeEngineDetails.project_id,
+ ...errorContext
+ }
+ });
+ }
+
+ if (zones.length && !zones.includes(computeEngineDetails.zone)) {
+ throw new UnauthorizedError({
+ message: `Access denied: GCP zone not allowed. [zone=${computeEngineDetails.zone}]`,
+ detail: {
+ reasonCode: ResourceAuthLoginFailureReason.ZoneNotAllowed,
+ serviceAccountEmail: identityDetails.email,
+ projectId: computeEngineDetails.project_id,
+ zone: computeEngineDetails.zone,
+ ...errorContext
+ }
+ });
+ }
+};
diff --git a/backend/src/ee/services/resource-auth-method/gcp-auth-validators.ts b/backend/src/ee/services/resource-auth-method/gcp-auth-validators.ts
new file mode 100644
index 0000000000..92483c87e2
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/gcp-auth-validators.ts
@@ -0,0 +1,40 @@
+import RE2 from "re2";
+import { z } from "zod";
+
+// Service accounts are matched against the token's `email` claim verbatim, so no wildcards here:
+// an entry that does not parse as a service account address can never match anything.
+const serviceAccountEntry = new RE2("^[a-z0-9-]{1,100}@[a-z0-9-]{1,100}\\.iam\\.gserviceaccount\\.com$");
+const projectEntry = new RE2("^[a-z][a-z0-9-]{4,28}[a-z0-9]$");
+const zoneEntry = new RE2("^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$");
+
+const csvOf = (pattern: RE2, field: string, max: number, allowed: string) =>
+ z
+ .string()
+ .trim()
+ .max(max)
+ .default("")
+ .refine(
+ (value) =>
+ value
+ .split(",")
+ .map((entry) => entry.trim())
+ .filter((entry) => entry.length > 0)
+ .every((entry) => pattern.test(entry)),
+ { message: `${field} must be a comma-separated list of ${allowed}` }
+ );
+
+export const validateAllowedServiceAccounts = csvOf(
+ serviceAccountEntry,
+ "Allowed service accounts",
+ 1024,
+ "GCP service account emails, for example [email protected]"
+);
+
+export const validateAllowedProjects = csvOf(projectEntry, "Allowed projects", 1024, "GCP project IDs");
+
+export const validateAllowedZones = csvOf(
+ zoneEntry,
+ "Allowed zones",
+ 1024,
+ "GCP zone names, for example us-central1-a"
+);
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts
index 9cb41ed74c..526b94a7dd 100644
--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts
@@ -171,7 +171,12 @@ export const ResourceAuthLoginFailureReason = {
NamespaceNotAllowed: "namespace_not_allowed",
NameNotAllowed: "name_not_allowed",
AudienceNotAllowed: "audience_not_allowed",
- GatewayProxyUnavailable: "gateway_proxy_unavailable"
+ GatewayProxyUnavailable: "gateway_proxy_unavailable",
+ GcpTokenVerificationFailed: "gcp_token_verification_failed",
+ ServiceAccountNotAllowed: "service_account_not_allowed",
+ ComputeEngineDetailsMissing: "compute_engine_details_missing",
+ ProjectNotAllowed: "project_not_allowed",
+ ZoneNotAllowed: "zone_not_allowed"
} as const;
// Who performs the TokenReview. Api means Infisical does, using the configured reviewer token.
@@ -186,10 +191,20 @@ export type TKubernetesTokenReviewMode = (typeof KubernetesTokenReviewMode)[keyo
export const ResourceAuthMethodType = {
Aws: "aws",
+ Gcp: "gcp",
Kubernetes: "kubernetes",
Token: "token",
Identity: "identity"
} as const;
+// "gce" verifies an ID token minted by the metadata server, "iam" a JWT the service account signed
+// through iamcredentials. Mirrors the machine identity GCP auth types.
+export const GcpAuthType = {
+ Gce: "gce",
+ Iam: "iam"
+} as const;
+
+export type TGcpAuthType = (typeof GcpAuthType)[keyof typeof GcpAuthType];
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type ResourceAuthMethodType = (typeof ResourceAuthMethodType)[keyof typeof ResourceAuthMethodType];
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-schemas.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-schemas.ts
index b9b6fd9b11..c6afb4de4f 100644
--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-schemas.ts
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-schemas.ts
@@ -11,6 +11,16 @@ export const AwsAuthMethodConfigSchema = z.object({
updatedAt: z.date()
});
+export const GcpAuthMethodConfigSchema = z.object({
+ id: z.string().uuid(),
+ type: z.string(),
+ allowedServiceAccounts: z.string(),
+ allowedProjects: z.string(),
+ allowedZones: z.string(),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
export const KubernetesAuthMethodConfigSchema = z.object({
id: z.string().uuid(),
kubernetesHost: z.string(),
@@ -36,6 +46,7 @@ export const IdentityAuthMethodConfigSchema = z.object({
export const AuthMethodViewSchema = z.discriminatedUnion("method", [
z.object({ method: z.literal(ResourceAuthMethodType.Aws), config: AwsAuthMethodConfigSchema }),
+ z.object({ method: z.literal(ResourceAuthMethodType.Gcp), config: GcpAuthMethodConfigSchema }),
z.object({ method: z.literal(ResourceAuthMethodType.Kubernetes), config: KubernetesAuthMethodConfigSchema }),
z.object({ method: z.literal(ResourceAuthMethodType.Token), config: TokenAuthMethodConfigSchema }),
z.object({ method: z.literal(ResourceAuthMethodType.Identity), config: IdentityAuthMethodConfigSchema })
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
index 5e37e4e8c7..c939c728ec 100644
--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
@@ -28,6 +28,8 @@ import { TRelayDALFactory } from "../relay/relay-dal";
import { TResourceAwsAuthDALFactory } from "./aws-auth-dal";
import { validateAllowlists, verifyStsAndExtractCaller } from "./aws-auth-fns";
import { TGatewayProxyRegistry } from "./gateway-proxy-registry";
+import { TResourceGcpAuthDALFactory } from "./gcp-auth-dal";
+import { validateGcpAllowlists, verifyGcpTokenAndExtractCaller } from "./gcp-auth-fns";
import { TResourceKubernetesAuthDALFactory } from "./kubernetes-auth-dal";
import {
assertKubernetesHostAllowed,
@@ -43,6 +45,7 @@ import {
assertGatewayResource,
assertKmipServerResource,
assertRelayResource,
+ GcpAuthType,
KubernetesTokenReviewMode,
mintAgentVaultProxyJwt,
mintGatewayJwt,
@@ -60,9 +63,11 @@ import {
TAuthMethodView,
TAwsAuthMethodConfig,
TEncryptedKubernetesSecrets,
+ TGcpAuthMethodConfig,
TGetAuthMethodDTO,
TKubernetesAuthMethodConfig,
TLoginWithAwsDTO,
+ TLoginWithGcpDTO,
TLoginWithKubernetesDTO,
TLoginWithTokenDTO,
TMintTokenDTO,
@@ -93,6 +98,7 @@ const $generateEnrollmentToken = (prefix: string) => {
type TResourceAuthMethodServiceFactoryDep = {
resourceAuthMethodDAL: TResourceAuthMethodDALFactory;
resourceAwsAuthDAL: TResourceAwsAuthDALFactory;
+ resourceGcpAuthDAL: TResourceGcpAuthDALFactory;
resourceKubernetesAuthDAL: TResourceKubernetesAuthDALFactory;
resourceTokenAuthDAL: TResourceTokenAuthDALFactory;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
@@ -157,6 +163,7 @@ type TBasicResource = { id: string; name: string; orgId: string | null; identity
export const resourceAuthMethodServiceFactory = ({
resourceAuthMethodDAL,
resourceAwsAuthDAL,
+ resourceGcpAuthDAL,
resourceKubernetesAuthDAL,
resourceTokenAuthDAL,
kmsService,
@@ -371,6 +378,25 @@ export const resourceAuthMethodServiceFactory = ({
};
}
+ if (registry.method === ResourceAuthMethodType.Gcp) {
+ const config = await resourceGcpAuthDAL.findOne({ authMethodId: registry.id });
+ if (!config) {
+ throw new NotFoundError({ message: `GCP auth config missing for ${resource.type}` });
+ }
+ return {
+ method: ResourceAuthMethodType.Gcp,
+ config: {
+ id: config.id,
+ type: config.type === GcpAuthType.Iam ? GcpAuthType.Iam : GcpAuthType.Gce,
+ allowedServiceAccounts: config.allowedServiceAccounts,
+ allowedProjects: config.allowedProjects,
+ allowedZones: config.allowedZones,
+ createdAt: config.createdAt,
+ updatedAt: config.updatedAt
+ }
+ };
+ }
+
if (registry.method === ResourceAuthMethodType.Kubernetes) {
const config = await resourceKubernetesAuthDAL.findOne({ authMethodId: registry.id });
if (!config) {
@@ -734,6 +760,7 @@ export const resourceAuthMethodServiceFactory = ({
resource: ResourceRef;
authMethod:
| { method: typeof ResourceAuthMethodType.Aws; config: TAwsAuthMethodConfig }
+ | { method: typeof ResourceAuthMethodType.Gcp; config: TGcpAuthMethodConfig }
| {
method: typeof ResourceAuthMethodType.Kubernetes;
config: TKubernetesAuthMethodConfig & TEncryptedKubernetesSecrets;
@@ -757,6 +784,18 @@ export const resourceAuthMethodServiceFactory = ({
tx
);
}
+ if (authMethod.method === ResourceAuthMethodType.Gcp) {
+ await resourceGcpAuthDAL.create(
+ {
+ authMethodId: registry.id,
+ type: authMethod.config.type,
+ allowedServiceAccounts: authMethod.config.allowedServiceAccounts,
+ allowedProjects: authMethod.config.allowedProjects,
+ allowedZones: authMethod.config.allowedZones
+ },
+ tx
+ );
+ }
if (authMethod.method === ResourceAuthMethodType.Kubernetes) {
await resourceKubernetesAuthDAL.create(
{
@@ -896,6 +935,13 @@ export const resourceAuthMethodServiceFactory = ({
) {
await resourceAwsAuthDAL.delete({ authMethodId: current.id }, tx);
}
+ if (
+ previousMethod === ResourceAuthMethodType.Gcp &&
+ authMethod.method !== ResourceAuthMethodType.Gcp &&
+ current
+ ) {
+ await resourceGcpAuthDAL.delete({ authMethodId: current.id }, tx);
+ }
if (
previousMethod === ResourceAuthMethodType.Kubernetes &&
authMethod.method !== ResourceAuthMethodType.Kubernetes &&
@@ -937,6 +983,22 @@ export const resourceAuthMethodServiceFactory = ({
}
}
+ if (authMethod.method === ResourceAuthMethodType.Gcp) {
+ const gcpFields = {
+ type: authMethod.type,
+ allowedServiceAccounts: authMethod.allowedServiceAccounts,
+ allowedProjects: authMethod.allowedProjects,
+ allowedZones: authMethod.allowedZones
+ };
+
+ const existingGcp = await resourceGcpAuthDAL.findOne({ authMethodId: registryRow.id }, tx);
+ if (existingGcp) {
+ await resourceGcpAuthDAL.updateById(existingGcp.id, gcpFields, tx);
+ } else {
+ await resourceGcpAuthDAL.create({ authMethodId: registryRow.id, ...gcpFields }, tx);
+ }
+ }
+
if (authMethod.method === ResourceAuthMethodType.Kubernetes) {
const sharedFields = {
kubernetesHost: authMethod.kubernetesHost || null,
@@ -1052,7 +1114,7 @@ export const resourceAuthMethodServiceFactory = ({
return {
resourceName: loaded.name,
orgId: loaded.orgId,
- method: registry.method as "aws" | "kubernetes" | "token"
+ method: registry.method as "aws" | "gcp" | "kubernetes" | "token"
};
};
@@ -1127,6 +1189,74 @@ export const resourceAuthMethodServiceFactory = ({
};
};
+ const loginWithGcp = async ({ resource, jwt }: TLoginWithGcpDTO) => {
+ const resourceLabel = RESOURCE_LABEL[resource.type];
+ const loaded = await $loadResource(resource);
+ if (!loaded || !loaded.orgId) {
+ throw new UnauthorizedError({ message: `Invalid ${resourceLabel.toLowerCase()} credentials` });
+ }
+ const resourceName = loaded.name;
+ const resourceOrgId = loaded.orgId;
+
+ const registry = await resourceAuthMethodDAL.findOne($registryFilter(resource));
+ if (!registry || registry.method !== ResourceAuthMethodType.Gcp) {
+ throw new UnauthorizedError({
+ message: `${resourceLabel} is not configured for GCP authentication`,
+ detail: {
+ reasonCode: ResourceAuthLoginFailureReason.MethodMismatch,
+ resourceId: resource.id,
+ orgId: resourceOrgId
+ }
+ });
+ }
+
+ const config = await resourceGcpAuthDAL.findOne({ authMethodId: registry.id });
+ if (!config) {
+ throw new UnauthorizedError({
+ message: `${resourceLabel} is not configured for GCP authentication`,
+ detail: {
+ reasonCode: ResourceAuthLoginFailureReason.ConfigMissing,
+ resourceId: resource.id,
+ orgId: resourceOrgId
+ }
+ });
+ }
+
+ const errorContext = { resourceId: resource.id, orgId: resourceOrgId, resourceName };
+ const type = config.type === GcpAuthType.Iam ? GcpAuthType.Iam : GcpAuthType.Gce;
+
+ const identityDetails = await verifyGcpTokenAndExtractCaller({
+ type,
+ jwt,
+ audience: resource.id,
+ errorContext
+ });
+
+ validateGcpAllowlists({
+ type,
+ identityDetails,
+ allowedServiceAccounts: config.allowedServiceAccounts,
+ allowedProjects: config.allowedProjects,
+ allowedZones: config.allowedZones,
+ errorContext
+ });
+
+ const refreshedTokenVersion = await $bumpTokenVersion(resource);
+
+ const accessToken = $mintJwt(resource, resourceOrgId, refreshedTokenVersion);
+
+ return {
+ accessToken,
+ resourceId: resource.id,
+ resourceName,
+ orgId: resourceOrgId,
+ configId: config.id,
+ serviceAccountEmail: identityDetails.email,
+ projectId: identityDetails.computeEngineDetails?.project_id,
+ zone: identityDetails.computeEngineDetails?.zone
+ };
+ };
+
const loginWithKubernetes = async ({ resource, jwt }: TLoginWithKubernetesDTO) => {
const resourceLabel = RESOURCE_LABEL[resource.type];
const loaded = await $loadResource(resource);
@@ -1306,6 +1436,7 @@ export const resourceAuthMethodServiceFactory = ({
mintToken,
revokeAccess,
loginWithAws,
+ loginWithGcp,
loginWithKubernetes,
loginWithToken
};
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts
index c9d43746fe..0d5e779631 100644
--- a/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts
@@ -1,6 +1,11 @@
import { OrgServiceActor } from "@app/lib/types";
-import { ResourceAuthMethodType, ResourceRef, TKubernetesTokenReviewMode } from "./resource-auth-method-fns";
+import {
+ ResourceAuthMethodType,
+ ResourceRef,
+ TGcpAuthType,
+ TKubernetesTokenReviewMode
+} from "./resource-auth-method-fns";
export type TAwsAuthMethodConfig = {
stsEndpoint: string;
@@ -8,6 +13,13 @@ export type TAwsAuthMethodConfig = {
allowedAccountIds: string;
};
+export type TGcpAuthMethodConfig = {
+ type: TGcpAuthType;
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+};
+
export type TKubernetesAuthMethodConfig = {
// Omitted only in gateway review mode, where the gateway calls its own API server.
kubernetesHost?: string | null;
@@ -48,6 +60,7 @@ export type TKubernetesAuthMethodConfigView = Omit<
export type TSetAuthMethodInput =
| ({ method: typeof ResourceAuthMethodType.Aws } & TAwsAuthMethodConfig)
+ | ({ method: typeof ResourceAuthMethodType.Gcp } & TGcpAuthMethodConfig)
| ({ method: typeof ResourceAuthMethodType.Kubernetes } & TKubernetesAuthMethodConfig)
| { method: typeof ResourceAuthMethodType.Token };
@@ -74,6 +87,11 @@ export type TLoginWithAwsDTO = {
iamRequestHeaders: string;
};
+export type TLoginWithGcpDTO = {
+ resource: ResourceRef;
+ jwt: string;
+};
+
export type TLoginWithKubernetesDTO = {
resource: ResourceRef;
jwt: string;
@@ -89,6 +107,10 @@ export type TAuthMethodView =
method: typeof ResourceAuthMethodType.Aws;
config: TAwsAuthMethodConfig & { id: string; createdAt: Date; updatedAt: Date };
}
+ | {
+ method: typeof ResourceAuthMethodType.Gcp;
+ config: TGcpAuthMethodConfig & { id: string; createdAt: Date; updatedAt: Date };
+ }
| {
method: typeof ResourceAuthMethodType.Kubernetes;
config: TKubernetesAuthMethodConfigView;
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index c71bf0321f..718c5fa75e 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -4021,11 +4021,11 @@ export const GATEWAYS = {
CREATE: {
name: "Name of the gateway.",
authMethod:
- "Auth method to configure on the gateway. `aws` carries the AWS allowlists; `kubernetes` carries the cluster host and namespace/service account allowlists; `token` is configurationless and requires a separate POST /v3/gateways/:id/token call to mint the bootstrap token."
+ "Auth method to configure on the gateway. `aws` carries the AWS allowlists; `gcp` carries the GCP token type and service account/project/zone allowlists; `kubernetes` carries the cluster host and namespace/service account allowlists; `token` is configurationless and requires a separate POST /v3/gateways/:id/token call to mint the bootstrap token."
},
UPDATE: {
authMethod:
- "Replacement auth method. Same shape as in create: `aws` with allowlists, `kubernetes` with cluster config, or `token` with no config. Existing gateways keep working until they restart and re-authenticate via the new method."
+ "Replacement auth method. Same shape as in create: `aws` with allowlists, `gcp` with GCP allowlists, `kubernetes` with cluster config, or `token` with no config. Existing gateways keep working until they restart and re-authenticate via the new method."
},
AUTH_METHOD: {
stsEndpoint: "The endpoint URL for the AWS STS API.",
@@ -4033,6 +4033,14 @@ export const GATEWAYS = {
"The comma-separated list of trusted IAM principal ARNs that are allowed to authenticate with Infisical.",
allowedAccountIds:
"The comma-separated list of trusted AWS account IDs that are allowed to authenticate with Infisical.",
+ gcpAuthType:
+ "How the gateway proves its GCP identity. 'gce' verifies an ID token from the instance metadata server, which covers Compute Engine VMs and GKE workload identity. 'iam' verifies a JWT the service account signed through the IAM Credentials API, for hosts outside Compute Engine.",
+ allowedServiceAccounts:
+ "The comma-separated list of GCP service account emails that are allowed to authenticate as this gateway.",
+ allowedProjects:
+ "The comma-separated list of GCP project IDs whose Compute Engine instances are allowed to authenticate as this gateway. Only applies to the 'gce' type, and requires a token carrying Compute Engine instance details.",
+ allowedZones:
+ "The comma-separated list of GCP zones whose Compute Engine instances are allowed to authenticate as this gateway. Only applies to the 'gce' type, and requires a token carrying Compute Engine instance details.",
kubernetesHost:
"The URL of the Kubernetes API server that Infisical reviews the gateway's service account token against (e.g. https://my-cluster.example.com:6443). Omit only when tokenReviewMode is 'gateway', where the reviewing gateway calls its own API server.",
tokenReviewMode:
@@ -4055,11 +4063,13 @@ export const GATEWAYS = {
"Whether to verify the Kubernetes API server's TLS certificate. Verified against the CA certificate when one is configured, otherwise against the system trust store."
},
LOGIN: {
- gatewayId: "The ID of the gateway logging in (AWS and Kubernetes methods only).",
+ gatewayId: "The ID of the gateway logging in (AWS, GCP and Kubernetes methods only).",
iamHttpRequestMethod: "The HTTP request method used in the signed STS request.",
iamRequestBody: "The base64-encoded body of the signed STS request.",
iamRequestHeaders: "The base64-encoded headers of the sts:GetCallerIdentity signed request.",
jwt: "The projected Kubernetes service account token of the pod the gateway runs in (Kubernetes method only).",
+ gcpJwt:
+ "The GCP token proving the gateway's identity, carrying the gateway ID as its audience: a metadata server ID token for the 'gce' type, or a service-account-signed JWT for the 'iam' type (GCP method only).",
token: "The one-time enrollment token previously issued for this gateway (token method only)."
}
} as const;
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index bfdc88c906..f13d3e70c0 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -173,6 +173,7 @@ import { relayDalFactory } from "@app/ee/services/relay/relay-dal";
import { relayServiceFactory } from "@app/ee/services/relay/relay-service";
import { resourceAwsAuthDALFactory } from "@app/ee/services/resource-auth-method/aws-auth-dal";
import { gatewayProxyRegistryFactory } from "@app/ee/services/resource-auth-method/gateway-proxy-registry";
+import { resourceGcpAuthDALFactory } from "@app/ee/services/resource-auth-method/gcp-auth-dal";
import { resourceKubernetesAuthDALFactory } from "@app/ee/services/resource-auth-method/kubernetes-auth-dal";
import { resourceAuthMethodDALFactory } from "@app/ee/services/resource-auth-method/resource-auth-method-dal";
import { resourceAuthMethodServiceFactory } from "@app/ee/services/resource-auth-method/resource-auth-method-service";
@@ -1726,6 +1727,7 @@ export const registerRoutes = async (
const resourceTokenAuthDAL = resourceTokenAuthDALFactory(db);
const resourceAuthMethodDAL = resourceAuthMethodDALFactory(db);
const resourceAwsAuthDAL = resourceAwsAuthDALFactory(db);
+ const resourceGcpAuthDAL = resourceGcpAuthDALFactory(db);
const resourceKubernetesAuthDAL = resourceKubernetesAuthDALFactory(db);
const gatewayPoolDAL = gatewayPoolDalFactory(db);
const gatewayPoolMembershipDAL = gatewayPoolMembershipDalFactory(db);
@@ -1924,6 +1926,7 @@ export const registerRoutes = async (
const resourceAuthMethodService = resourceAuthMethodServiceFactory({
resourceAuthMethodDAL,
resourceAwsAuthDAL,
+ resourceGcpAuthDAL,
resourceKubernetesAuthDAL,
resourceTokenAuthDAL,
kmsService,
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.ts
index 4864158608..f104a22b72 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
@@ -10,25 +10,16 @@ import { TDecodedGcpIamAuthJwt, TGcpIdTokenPayload } from "./identity-gcp-auth-t
/**
* 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} audience - The Infisical-side ID the token must be bound to: an identity ID for machine
+ * identity auth, a gateway ID for gateway GCP auth.
* @param {string} jwt - The identity token to validate.
- * @param {string} credentials - The credentials in the GCP Auth configuration for Infisical.
*/
-export const validateIdTokenIdentity = async ({
- identityId,
- jwt: identityToken
-}: {
- identityId: string;
- jwt: string;
-}) => {
+export const validateIdTokenIdentity = async ({ audience, jwt: identityToken }: { audience: string; jwt: string }) => {
const oAuth2Client = new OAuth2Client();
const response = await oAuth2Client.getFederatedSignonCerts();
- const ticket = await oAuth2Client.verifySignedJwtWithCertsAsync(
- identityToken,
- response.certs,
- identityId, // audience
- ["https://accounts.google.com"]
- );
+ const ticket = await oAuth2Client.verifySignedJwtWithCertsAsync(identityToken, response.certs, audience, [
+ "https://accounts.google.com"
+ ]);
const payload = ticket.getPayload() as TGcpIdTokenPayload;
if (!payload || !payload.email) throw new UnauthorizedError();
@@ -39,18 +30,12 @@ const serviceAccountEmailRegex = new RE2(/^[a-z0-9-]+@[a-z0-9-]+\.iam\.gservicea
/**
* Validates that the signed JWT token for a GCP service account is valid as part of GCP IAM authentication.
- * @param {string} identityId - The ID of the identity in Infisical that is being authenticated against (used as audience).
+ * @param {string} audience - The Infisical-side ID the token must be bound to: an identity ID for machine
+ * identity auth, a gateway ID for gateway GCP auth.
* @param {string} jwt - The signed JWT token to validate.
- * @param {string} credentials - The credentials in the GCP Auth configuration for Infisical.
* @returns
*/
-export const validateIamIdentity = async ({
- identityId,
- jwt: serviceAccountJwt
-}: {
- identityId: string;
- jwt: string;
-}) => {
+export const validateIamIdentity = async ({ audience, jwt: serviceAccountJwt }: { audience: string; jwt: string }) => {
const decodedJwt = crypto.jwt().decode(serviceAccountJwt, { complete: true }) as TDecodedGcpIamAuthJwt;
const { sub, aud } = decodedJwt.payload;
@@ -72,6 +57,6 @@ export const validateIamIdentity = async ({
algorithms: ["RS256"]
});
- if (aud !== identityId) throw new UnauthorizedError({ message: "Invalid audience in GCP IAM Token" });
+ if (aud !== audience) throw new UnauthorizedError({ message: "Invalid audience in GCP IAM Token" });
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.ts
index 8f0c5a6892..9491423ea2 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
@@ -106,14 +106,14 @@ export const identityGcpAuthServiceFactory = ({
switch (identityGcpAuth.type) {
case "gce": {
gcpIdentityDetails = await validateIdTokenIdentity({
- identityId,
+ audience: identityId,
jwt: gcpJwt
});
break;
}
case "iam": {
gcpIdentityDetails = await validateIamIdentity({
- identityId,
+ audience: identityId,
jwt: gcpJwt
});
break;
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index 56b1372977..de03313f67 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -1276,7 +1276,7 @@ export type TResourceAuthMethodEvent = {
resourceType: "gateway";
resourceId: string;
orgId: string;
- method: "aws" | "kubernetes" | "token";
+ method: "aws" | "gcp" | "kubernetes" | "token";
};
};
diff --git a/docs/cli/commands/gateway.mdx b/docs/cli/commands/gateway.mdx
index 9ad109c2b9..ac4a9ae995 100644
--- a/docs/cli/commands/gateway.mdx
+++ b/docs/cli/commands/gateway.mdx
@@ -65,7 +65,7 @@ In direct listen mode it also:
<AccordionGroup>
<Accordion title="--enroll-method">
- How the gateway authenticates with Infisical. Must match the auth method configured on the gateway in the Infisical UI. One of `token`, `aws`, or `kubernetes`.
+ How the gateway authenticates with Infisical. Must match the auth method configured on the gateway in the Infisical UI. One of `token`, `aws`, `gcp`, or `kubernetes`.
<Tabs>
<Tab title="token">
@@ -106,6 +106,34 @@ In direct listen mode it also:
infisical gateway start my-gateway --enroll-method=aws --gateway-id=<gateway-id> --domain=https://app.infisical.com
```
</Tab>
+ <Tab title="gcp">
+ The gateway proves which GCP service account it runs as, and re-authenticates on every start. No token is stored on disk. The token carries the gateway ID as its audience.
+
+ <ParamField query="Flags">
+ <Expandable title="properties">
+ <ParamField query="gateway-id" type="string" required>
+ The gateway ID from the Infisical UI.
+ </ParamField>
+ <ParamField query="domain" type="string" required>
+ The URL of your Infisical instance.
+ </ParamField>
+ <ParamField query="gcp-auth-type" type="string">
+ How the identity is proven. `gce` reads a token from the instance metadata server, which covers Compute Engine VMs and GKE pods using workload identity. `iam` signs one through the IAM Credentials API. Defaults to `gce`.
+ </ParamField>
+ <ParamField query="service-account-key-file-path" type="string">
+ Only for `--gcp-auth-type=iam`, and only when the host has no credentials of its own. Path to a service account key file to sign with.
+ </ParamField>
+ </Expandable>
+ </ParamField>
+
+ ```bash
+ infisical gateway start my-gateway --enroll-method=gcp --gateway-id=<gateway-id> --domain=https://app.infisical.com
+ ```
+
+ The `iam` type needs the IAM Service Account Credentials API enabled and `roles/iam.serviceAccountTokenCreator` on the service account being signed as.
+
+ See [Gateway Deployment](/documentation/platform/gateways/gateway-deployment) for the allowlist configuration this method needs.
+ </Tab>
<Tab title="kubernetes">
The gateway authenticates with the projected service account token of the pod it runs in, so no credential has to be distributed to the cluster. Infisical verifies the token against your cluster's TokenReview API and re-authenticates on every start. No token is stored on disk.
@@ -229,7 +257,7 @@ sudo infisical gateway systemd install my-gateway --enroll-method=token --token=
<AccordionGroup>
<Accordion title="--enroll-method">
- How the gateway authenticates with Infisical. One of `token` or `aws`.
+ How the gateway authenticates with Infisical. One of `token`, `aws`, or `gcp`.
```bash
# Enrollment token
@@ -237,6 +265,9 @@ sudo infisical gateway systemd install my-gateway --enroll-method=token --token=
# AWS auth, re-authenticated on every service start
sudo infisical gateway systemd install my-gateway --enroll-method=aws --gateway-id=<gateway-id> --domain=<domain>
+
+ # GCP auth, re-authenticated on every service start
+ sudo infisical gateway systemd install my-gateway --enroll-method=gcp --gateway-id=<gateway-id> --domain=<domain>
```
`kubernetes` is not available here. In-cluster gateways are not managed by systemd, so run `infisical gateway start --enroll-method=kubernetes` as the container command instead.
diff --git a/docs/documentation/platform/gateways/gateway-deployment.mdx b/docs/documentation/platform/gateways/gateway-deployment.mdx
index 96a3dfd070..8830fb8bb3 100644
--- a/docs/documentation/platform/gateways/gateway-deployment.mdx
+++ b/docs/documentation/platform/gateways/gateway-deployment.mdx
@@ -48,11 +48,12 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arc
![Create Gateway button](/images/platform/gateways/gateway-create-button.png)
3. Enter a name for the gateway, then select **Create Gateway**.
![Create Gateway form](/images/platform/gateways/gateway-create-form.png)
- 4. (Optional) Open the new gateway's detail page and change the method under **Authentication** in the **Details** card. Three methods are supported:
+ 4. (Optional) Open the new gateway's detail page and change the method under **Authentication** in the **Details** card. Four methods are supported:
- **Token** (default): a one-time enrollment token (1h expiry) bootstraps the gateway.
- **AWS**: the gateway authenticates by signing an `sts:GetCallerIdentity` request with whatever AWS credentials it can resolve on the host (instance role, env vars, shared profile). Configure the allowed principal ARNs and/or account IDs that match your hosts.
+ - **GCP**: the gateway authenticates with a token from the GCP metadata server, so no credential has to be distributed to the instance or cluster. Configure the allowed service accounts, and optionally the allowed projects and zones.
- **Kubernetes**: the gateway authenticates with the projected service account token of the pod it runs in, so no credential has to be distributed to the cluster. Configure the cluster's API server URL and the allowed namespaces and/or service account names.
- 5. In the **Deployment** card, select **Generate deploy command**. For the AWS and Kubernetes methods the command is shown without this step.
+ 5. In the **Deployment** card, select **Generate deploy command**. For the AWS, GCP and Kubernetes methods the command is shown without this step.
6. Under **Connection Mode**, select **Direct Listen** or **Relay**.
- For **Direct Listen**, enter the **Listen Address** that Infisical will dial, as `host:port`.
- For **Relay**, pick a relay, or leave **Auto Select Relay** so the gateway chooses the healthiest one.
@@ -225,6 +226,76 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arc
</Tab>
</Tabs>
</Accordion>
+ <Accordion title="GCP Auth">
+ The gateway sends a token proving which GCP service account it runs as, and Infisical verifies that token against Google's signing keys. Nothing has to be copied onto the instance, so this is the method to use when gateway creation is automated on GCP. The gateway re-authenticates on every start.
+
+ The token carries the gateway's ID as its audience, so a token minted for one gateway cannot authenticate as another.
+
+ Before deploying, configure the GCP auth method on the gateway's detail page:
+
+ | Field | Description |
+ | --- | --- |
+ | **Type** | **GCP ID Token Auth** reads a token from the instance metadata server, which covers Compute Engine VMs and GKE pods using workload identity. **GCP IAM Auth** signs one through the IAM Credentials API, for hosts outside Compute Engine. |
+ | **Allowed Service Account Emails** | Service account emails that may authenticate as this gateway. |
+ | **Allowed Projects** | Optional. Project IDs whose Compute Engine instances may authenticate as this gateway. |
+ | **Allowed Zones** | Optional, and only a narrowing of the two above. Zones whose Compute Engine instances may authenticate as this gateway. |
+
+ **Allowed Service Account Emails** or **Allowed Projects** is required. Either one names something inside your organization that nobody else can create.
+
+ Prefer the service account where you can. Restricting by project alone trusts every instance in that project, including one created by anyone who holds `compute.instances.create` there.
+
+ <Warning>
+ **Allowed Zones** is a narrowing on top of one of those, never a restriction on its own. Zone names are a global namespace, so any GCP customer can place an instance in `us-central1-a` and match a zone-only configuration. A config carrying only zones is refused.
+ </Warning>
+
+ <Warning>
+ **Allowed Projects** and **Allowed Zones** are matched against Compute Engine instance details carried inside the token. Only a token from a Compute Engine VM carries them. A GKE workload identity token does not, nor does an IAM service account token, and a login presenting one is refused rather than skipping the check. On GKE, restrict by service account instead.
+ </Warning>
+
+ <Tabs>
+ <Tab title="GKE (Helm)">
+ Install the Infisical Helm chart repository:
+ ```bash
+ helm repo add infisical https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/
+ helm repo update
+ ```
+
+ Install the gateway with [Workload Identity Federation](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity):
+ ```bash
+ helm install infisical-gateway infisical/infisical-gateway \
+ --namespace infisical-gateway --create-namespace \
+ --set gateway.name=<gateway-name> \
+ --set gateway.enrollment.method=gcp \
+ --set gateway.enrollment.gcp.gatewayId=<gateway-id> \
+ --set gateway.domain=<your-infisical-domain> \
+ --set serviceAccount.annotations."iam\.gke\.io/gcp-service-account"=<gsa-name>@<project-id>.iam.gserviceaccount.com
+ ```
+
+ <Info>
+ The Google service account in that annotation is the one Infisical sees, so put its email in the gateway's **Allowed Service Account Emails**. Its IAM policy also needs a `roles/iam.workloadIdentityUser` binding for the Kubernetes service account the chart creates.
+ </Info>
+ </Tab>
+ <Tab title="Compute Engine (Production)">
+ ```bash
+ sudo infisical gateway systemd install <gateway-name> \
+ --enroll-method=gcp \
+ --gateway-id=<gateway-id> \
+ --domain=<your-infisical-domain>
+ sudo systemctl start <gateway-name>
+ ```
+ </Tab>
+ <Tab title="Foreground">
+ ```bash
+ infisical gateway start <gateway-name> \
+ --enroll-method=gcp \
+ --gateway-id=<gateway-id> \
+ --domain=<your-infisical-domain>
+ ```
+
+ Add `--gcp-auth-type=iam` to sign the token through the IAM Credentials API instead of reading it from the metadata server. That path needs the IAM Service Account Credentials API enabled and `roles/iam.serviceAccountTokenCreator` on the service account being signed as. Point `--service-account-key-file-path` at a key file when the host has no credentials of its own.
+ </Tab>
+ </Tabs>
+ </Accordion>
<Accordion title="Kubernetes Auth">
The gateway sends the projected service account token of its own pod, and Infisical verifies it against your cluster's TokenReview API. Nothing has to be copied into the cluster, so this is the method to use when gateway creation is automated. The gateway re-authenticates on every start.
@@ -257,7 +328,7 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arc
<Warning>
A gateway can't review its own token. The proxy runs over the gateway's own tunnel, which only exists once it has already authenticated, so the reviewer must be a different gateway that is already enrolled and connected.
- This means the **first** gateway in a private cluster can't use Kubernetes auth. Enrol it with an enrollment token or AWS auth, then point later gateways at it. Deleting a gateway that other gateways use as their reviewer is refused until they're pointed elsewhere.
+ This means the **first** gateway in a private cluster can't use Kubernetes auth. Enrol it with an enrollment token, AWS auth or GCP auth, then point later gateways at it. Deleting a gateway that other gateways use as their reviewer is refused until they're pointed elsewhere.
</Warning>
<Tabs>
@@ -298,7 +369,7 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arc
</Tabs>
<Warning>
- Infisical must be able to reach the cluster's API server to review the token. For a cluster with no publicly reachable API server, use Token or AWS auth instead.
+ Infisical must be able to reach the cluster's API server to review the token. For a cluster with no publicly reachable API server, use Token, AWS or GCP auth instead. On GKE, GCP auth needs no inbound path at all.
</Warning>
</Accordion>
</AccordionGroup>
@@ -327,7 +398,7 @@ For the ports, certificates, and traffic flow behind each mode, see [Network arc
From the gateway's detail page (select the gateway row in the list):
-- **Generate deploy command**: Generates a fresh enrollment token (token method) or re-displays the start command for the AWS and Kubernetes methods. Selecting this on a token-method gateway doesn't disconnect the running gateway; the next login with the new token rotates credentials atomically.
+- **Generate deploy command**: Generates a fresh enrollment token (token method) or re-displays the start command for the AWS, GCP and Kubernetes methods. Selecting this on a token-method gateway doesn't disconnect the running gateway; the next login with the new token rotates credentials atomically.
- **Edit auth method**: Switch between Token, AWS, and Kubernetes, or update the allowlists of the current method. Existing gateways keep their JWT until they restart and re-authenticate.
- **Options → Revoke Access** — Disconnects the running gateway and invalidates outstanding enrollment tokens. The gateway must re-authenticate to reconnect. Gated by the dedicated `revoke-gateway-access` permission, separate from `edit-gateways`.
- **Options → Delete Gateway** — Permanently removes the gateway.
diff --git a/docs/self-hosting/helm-charts/gateway.mdx b/docs/self-hosting/helm-charts/gateway.mdx
index 6a0ac0a05e..38857c7f11 100644
--- a/docs/self-hosting/helm-charts/gateway.mdx
+++ b/docs/self-hosting/helm-charts/gateway.mdx
@@ -49,6 +49,32 @@ For a full overview of how gateways work, see the [Gateway documentation](/docum
```
</Tab>
+ <Tab title="GCP Auth">
+ ```bash
+ helm install infisical-gateway infisical-helm-charts/infisical-gateway \
+ --namespace infisical-gateway \
+ --create-namespace \
+ --set gateway.name=<gateway-name> \
+ --set gateway.enrollment.method=gcp \
+ --set gateway.enrollment.gcp.gatewayId=<gateway-id> \
+ --set gateway.domain=https://app.infisical.com \
+ --set serviceAccount.annotations."iam\.gke\.io/gcp-service-account"=<gsa-name>@<project-id>.iam.gserviceaccount.com
+ ```
+
+ The gateway reads an identity token from the GKE metadata server, so no credential has to be
+ distributed to the cluster.
+
+ <Warning>
+ The Google service account in that annotation is the identity Infisical sees, so its email
+ must be in the gateway's allowed service account emails. Its IAM policy also needs a
+ `roles/iam.workloadIdentityUser` binding for the Kubernetes service account the chart
+ creates. A workload identity token carries no Compute Engine instance details, so a login
+ is refused while the gateway has an allowed projects or zones list. See
+ [Gateway Deployment](/documentation/platform/gateways/gateway-deployment) for the full
+ configuration.
+ </Warning>
+ </Tab>
+
<Tab title="Kubernetes Auth">
```bash
helm install infisical-gateway infisical-helm-charts/infisical-gateway \
@@ -93,11 +119,14 @@ helm uninstall infisical-gateway --namespace infisical-gateway
|-----------|---------|-------------|
| `gateway.name` | `""` | Name of the gateway as created in the Infisical UI. |
| `gateway.domain` | `""` | Infisical instance URL (e.g., `https://app.infisical.com`). |
-| `gateway.enrollment.method` | `""` | Enrollment method: `token`, `aws`, or `kubernetes`. |
+| `gateway.enrollment.method` | `""` | Enrollment method: `token`, `aws`, `gcp`, or `kubernetes`. |
| `gateway.enrollment.token.value` | `""` | Inline enrollment token. Mutually exclusive with `existingSecretRef`. |
| `gateway.enrollment.token.existingSecretRef` | `""` | Kubernetes secret containing the enrollment token. |
| `gateway.enrollment.token.secretKey` | `"enrollment-token"` | Key in the secret that holds the token. |
| `gateway.enrollment.aws.gatewayId` | `""` | Gateway ID from the Infisical UI. Required for AWS auth. |
+| `gateway.enrollment.gcp.gatewayId` | `""` | Gateway ID from the Infisical UI. Required for GCP auth. |
+| `gateway.enrollment.gcp.type` | `""` | How the identity is proven: `gce` reads a token from the metadata server, `iam` signs one through the IAM Credentials API. Empty means `gce`. |
+| `gateway.enrollment.gcp.serviceAccountKeyFilePath` | `""` | Only for `type: iam` on a pod with no workload identity. Path to a service account key file you mount yourself. |
| `gateway.enrollment.kubernetes.gatewayId` | `""` | Gateway ID from the Infisical UI. Required for Kubernetes auth. |
| `gateway.enrollment.kubernetes.serviceAccountTokenPath` | `""` | Override the projected service account token path. Defaults to `/var/run/secrets/kubernetes.io/serviceaccount/token`. |
| `gateway.enrollment.kubernetes.externalTokenReview` | `false` | Set true when TokenReview permission comes from outside this chart, either a token reviewer JWT configured in Infisical or a binding you manage. Required to install with `serviceAccount.createAsAuthDelegator` disabled. |
@@ -189,6 +218,18 @@ gateway:
# Required when method=aws. Gateway ID from the Infisical UI.
gatewayId: ""
+ # GCP enrollment settings (method=gcp)
+ gcp:
+ # Required when method=gcp. Gateway ID from the Infisical UI.
+ gatewayId: ""
+ # How the gateway proves its GCP identity: "gce" reads an identity token from the instance
+ # metadata server, which covers GKE workload identity; "iam" signs a JWT through the IAM
+ # Credentials API. Leave empty for the CLI default of "gce".
+ type: ""
+ # Only for type=iam, and only when the pod has no workload identity to sign with. Path to a
+ # service account key file, which you must mount yourself.
+ serviceAccountKeyFilePath: ""
+
# Kubernetes enrollment settings (method=kubernetes).
kubernetes:
# Required when method=kubernetes. Gateway ID from the Infisical UI.
diff --git a/frontend/src/hooks/api/gateways-v2/mutations.tsx b/frontend/src/hooks/api/gateways-v2/mutations.tsx
index 675ca94819..1b6ae51bed 100644
--- a/frontend/src/hooks/api/gateways-v2/mutations.tsx
+++ b/frontend/src/hooks/api/gateways-v2/mutations.tsx
@@ -104,7 +104,7 @@ export const useRevokeGatewayAccess = () => {
return useMutation({
mutationFn: async ({ gatewayId }: { gatewayId: string }) => {
const { data } = await apiRequest.post<{
- method: "aws" | "kubernetes" | "token";
+ method: "aws" | "gcp" | "kubernetes" | "token";
}>(`/api/v3/gateways/${gatewayId}/revoke`);
return data;
},
diff --git a/frontend/src/hooks/api/gateways-v2/types.ts b/frontend/src/hooks/api/gateways-v2/types.ts
index a5f7446d31..4991b6a43c 100644
--- a/frontend/src/hooks/api/gateways-v2/types.ts
+++ b/frontend/src/hooks/api/gateways-v2/types.ts
@@ -27,6 +27,16 @@ export type GatewayAwsAuthConfig = {
updatedAt: string;
};
+export type GatewayGcpAuthConfig = {
+ id: string;
+ type: "gce" | "iam";
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ createdAt: string;
+ updatedAt: string;
+};
+
export type GatewayKubernetesAuthConfig = {
id: string;
kubernetesHost: string;
@@ -52,6 +62,7 @@ export type GatewayIdentityAuthConfig = {
export type GatewayAuthMethodView =
| { method: "aws"; config: GatewayAwsAuthConfig }
+ | { method: "gcp"; config: GatewayGcpAuthConfig }
| { method: "kubernetes"; config: GatewayKubernetesAuthConfig }
| { method: "token"; config: GatewayTokenAuthConfig }
| { method: "identity"; config: GatewayIdentityAuthConfig };
@@ -67,6 +78,13 @@ export type SettableAuthMethodInput =
allowedPrincipalArns: string;
allowedAccountIds: string;
}
+ | {
+ method: "gcp";
+ type: "gce" | "iam";
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ }
| {
method: "kubernetes";
// Omitted only in gateway review mode, where the gateway calls its own API server.
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/GcpStartCommandDialog.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/GcpStartCommandDialog.tsx
new file mode 100644
index 0000000000..0a282ee4ca
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/GcpStartCommandDialog.tsx
@@ -0,0 +1,126 @@
+import { useMemo, useState } from "react";
+
+import {
+ CodeBlock,
+ Field,
+ FieldDescription,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ TabsContent
+} from "@app/components/v3";
+import { useGetRelays } from "@app/hooks/api/relays/queries";
+
+type Props = {
+ gatewayId: string;
+ gatewayName: string;
+ gcpAuthType: "gce" | "iam";
+ isDirect: boolean;
+ listenAddress: string;
+};
+
+const AUTO_RELAY_OPTION = { id: "_auto", name: "Auto Select Relay" };
+
+const PLACEHOLDER_ADDRESS = "<gateway-address>:8443";
+
+export const GcpStartCommandContent = ({
+ gatewayId,
+ gatewayName,
+ gcpAuthType,
+ isDirect,
+ listenAddress
+}: Props) => {
+ const { protocol, hostname, port } = window.location;
+ const portSuffix = port && port !== "80" ? `:${port}` : "";
+ const siteURL = `${protocol}//${hostname}${portSuffix}`;
+
+ const { data: relays, isPending: isRelaysLoading } = useGetRelays();
+ const [relay, setRelay] = useState<{ id: string; name: string }>(AUTO_RELAY_OPTION);
+
+ const resolvedRelayName = isDirect || relay.id === "_auto" ? "" : relay.name;
+ // gce is the CLI default, so only the iam type needs the flag spelled out.
+ const authTypePart = gcpAuthType === "iam" ? " --gcp-auth-type=iam" : "";
+
+ const cliCommand = useMemo(() => {
+ const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
+ const directPart = isDirect ? ` --listen-address=${listenAddress || PLACEHOLDER_ADDRESS}` : "";
+ return `infisical gateway start ${gatewayName} --enroll-method=gcp --gateway-id=${gatewayId}${authTypePart}${relayPart}${directPart} --domain=${siteURL}`;
+ }, [gatewayName, gatewayId, authTypePart, isDirect, listenAddress, resolvedRelayName, siteURL]);
+
+ const systemdInstallCommand = useMemo(() => {
+ const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
+ const directPart = isDirect ? ` --listen-address=${listenAddress || PLACEHOLDER_ADDRESS}` : "";
+ return `sudo infisical gateway systemd install ${gatewayName} --enroll-method=gcp --gateway-id=${gatewayId}${authTypePart}${relayPart}${directPart} --domain=${siteURL}`;
+ }, [gatewayName, gatewayId, authTypePart, isDirect, listenAddress, resolvedRelayName, siteURL]);
+
+ const helmCommand = useMemo(() => {
+ const directPart = isDirect
+ ? ` \\\n --set gateway.listenAddress=${listenAddress || PLACEHOLDER_ADDRESS}`
+ : "";
+ const relayPart = resolvedRelayName
+ ? ` \\\n --set gateway.relayName=${resolvedRelayName}`
+ : "";
+ const authTypeSet = gcpAuthType === "iam" ? ` \\\n --set gateway.enrollment.gcp.type=iam` : "";
+ return `helm repo add infisical https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/
+helm install infisical-gateway infisical/infisical-gateway \\
+ --namespace infisical-gateway --create-namespace \\
+ --set gateway.name=${gatewayName} \\
+ --set gateway.domain=${siteURL} \\
+ --set gateway.enrollment.method=gcp \\
+ --set gateway.enrollment.gcp.gatewayId=${gatewayId}${authTypeSet}${relayPart}${directPart}`;
+ }, [gatewayName, gatewayId, gcpAuthType, isDirect, listenAddress, resolvedRelayName, siteURL]);
+
+ const startServiceCommand = `sudo systemctl start ${gatewayName}`;
+
+ return (
+ <div className="min-w-0 space-y-4">
+ <TabsContent value="cli" className="min-w-0">
+ <CodeBlock value={cliCommand} label="Command" />
+ </TabsContent>
+ <TabsContent value="systemd" className="min-w-0 space-y-4">
+ <CodeBlock value={systemdInstallCommand} label="Install service" />
+ <CodeBlock value={startServiceCommand} label="Start service" />
+ </TabsContent>
+ <TabsContent value="helm" className="min-w-0">
+ <CodeBlock value={helmCommand} label="Command" />
+ </TabsContent>
+ {!isDirect && (
+ <Field>
+ <Select
+ value={relay.id}
+ onValueChange={(id: string) =>
+ setRelay(
+ [AUTO_RELAY_OPTION, ...(relays || [])].find((item) => item.id === id) ||
+ AUTO_RELAY_OPTION
+ )
+ }
+ disabled={isRelaysLoading}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue placeholder="Select relay" />
+ </SelectTrigger>
+ <SelectContent>
+ {[AUTO_RELAY_OPTION, ...(relays || [])].map((item) => (
+ <SelectItem key={item.id} value={item.id}>
+ {item.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {relay.id !== "_auto" && (
+ <FieldDescription>
+ * Auto Select chooses a healthy relay and fails over if needed.
+ </FieldDescription>
+ )}
+ </Field>
+ )}
+ <p className="text-xs text-muted">
+ {gcpAuthType === "iam"
+ ? "Requires credentials holding roles/iam.serviceAccountTokenCreator on a service account in the configured allowlist."
+ : "Requires the gateway to run on a Compute Engine instance, or a GKE pod with workload identity, whose service account matches the configured allowlist."}
+ </p>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx
index 0458f965de..8543128325 100644
--- a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx
@@ -38,6 +38,7 @@ import { useMintGatewayToken } from "@app/hooks/api/gateways-v2";
import { GatewayAuthMethodView, TGatewayEnrollmentToken } from "@app/hooks/api/gateways-v2/types";
import { AwsStartCommandContent } from "../GatewayAuthMethod/AwsStartCommandDialog";
+import { GcpStartCommandContent } from "../GatewayAuthMethod/GcpStartCommandDialog";
import { EnrollmentTokenContent } from "../GatewayAuthMethod/EnrollmentTokenDialog";
import { KubernetesStartCommandContent } from "../GatewayAuthMethod/KubernetesStartCommandDialog";
@@ -80,6 +81,7 @@ export const GatewayDeploySection = ({
}: Props) => {
const isCloud = isInfisicalCloud();
const isKubernetes = authMethod.method === "kubernetes";
+ const isGcp = authMethod.method === "gcp";
// Relay only for Cloud, which cannot route inward, and for a gateway already running relay alone.
const isRelayOnlyGateway = Boolean(relayId) && !directAddress;
const [connectionMode, setConnectionMode] = useState<"relay" | "direct">(
@@ -107,10 +109,14 @@ export const GatewayDeploySection = ({
if (authMethod.method === "identity") return null;
- const showDeploymentControls = authMethod.method === "aws" || isKubernetes || Boolean(enrollment);
+ const showDeploymentControls =
+ authMethod.method === "aws" || isKubernetes || isGcp || Boolean(enrollment);
// Derived, so switching auth method can't leave a tab selected that the new method lacks.
- const deploymentTabs = isKubernetes ? ["helm", "cli"] : ["cli", "systemd"];
+ let deploymentTabs = ["cli", "systemd"];
+ if (isKubernetes) deploymentTabs = ["helm", "cli"];
+ // A GCP gateway runs on a Compute Engine VM or in GKE, so it gets every target.
+ if (isGcp) deploymentTabs = ["cli", "systemd", "helm"];
const activeTab = deploymentTabs.includes(deploymentMethod)
? deploymentMethod
: deploymentTabs[0];
@@ -152,15 +158,17 @@ export const GatewayDeploySection = ({
{canEditGateway && showDeploymentControls && (
<CardAction>
<TabsList variant="filled" aria-label="Deployment method">
- {isKubernetes ? (
+ {isKubernetes && (
<>
<TabsTrigger value="helm">Helm</TabsTrigger>
<TabsTrigger value="cli">Container command</TabsTrigger>
</>
- ) : (
+ )}
+ {!isKubernetes && (
<>
<TabsTrigger value="cli">CLI</TabsTrigger>
<TabsTrigger value="systemd">System service</TabsTrigger>
+ {isGcp && <TabsTrigger value="helm">Helm</TabsTrigger>}
</>
)}
</TabsList>
@@ -240,6 +248,16 @@ export const GatewayDeploySection = ({
/>
)}
+ {authMethod.method === "gcp" && (
+ <GcpStartCommandContent
+ gatewayId={gatewayId}
+ gatewayName={gatewayName}
+ gcpAuthType={authMethod.config.type}
+ isDirect={connectionMode === "direct"}
+ listenAddress={commandListenAddress}
+ />
+ )}
+
{isKubernetes && (
<KubernetesStartCommandContent
gatewayId={gatewayId}
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx
index 0c5b4e8117..a4f8de5dd4 100644
--- a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx
@@ -205,7 +205,7 @@ export const GatewayDetailsCard = ({ gateway }: { gateway: TGatewayV2WithAuthMet
currentMethod={authMethod}
isDisabled={!isAllowed}
isPending={isUpdatingAuthMethod}
- availableMethods={["token", "aws", "kubernetes"]}
+ availableMethods={["token", "aws", "gcp", "kubernetes"]}
currentGatewayId={gateway.id}
onUpdate={async (form) => {
try {
diff --git a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx
index ac425661bd..effb5fc914 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx
@@ -8,6 +8,7 @@ import {
Button,
Field,
FieldContent,
+ FieldDescription,
FieldError,
FieldLabel,
FilterableSelect,
@@ -28,6 +29,11 @@ import {
NetworkingAuthMethodSingleValue
} from "./NetworkingAuthMethodLabel";
+const GCP_AUTH_TYPE_OPTIONS = [
+ { value: "gce" as const, label: "GCP ID Token Auth (Recommended)" },
+ { value: "iam" as const, label: "GCP IAM Auth" }
+];
+
const REVIEW_MODE_OPTIONS = [
{ value: "gateway" as const, label: "Gateway as Reviewer" },
{ value: "api" as const, label: "Manual Token Reviewer JWT (API)" }
@@ -35,10 +41,14 @@ const REVIEW_MODE_OPTIONS = [
const schema = z
.object({
- method: z.enum(["aws", "kubernetes", "token"]),
+ method: z.enum(["aws", "gcp", "kubernetes", "token"]),
stsEndpoint: z.string(),
allowedPrincipalArns: z.string(),
allowedAccountIds: z.string(),
+ gcpAuthType: z.enum(["gce", "iam"]),
+ allowedServiceAccounts: z.string(),
+ allowedProjects: z.string(),
+ allowedZones: z.string(),
kubernetesHost: z.string(),
caCertificate: z.string(),
tokenReviewerJwt: z.string(),
@@ -75,6 +85,29 @@ const schema = z
});
}
+ if (data.method === "gcp") {
+ // Zones alone restrict nothing: the zone namespace is global, so any GCP customer can put an
+ // instance in one.
+ if (!data.allowedServiceAccounts.trim() && !data.allowedProjects.trim()) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["allowedServiceAccounts"],
+ message:
+ "Set allowed service account emails or allowed projects. A zone on its own restricts nothing, because any GCP customer can create an instance in a given zone."
+ });
+ }
+ // An IAM-signed JWT carries no instance details, so a project or zone allowlist on it could
+ // never be checked and every login would be refused.
+ if (data.gcpAuthType === "iam" && (data.allowedProjects.trim() || data.allowedZones.trim())) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["allowedProjects"],
+ message:
+ "Allowed projects and zones only apply to the Compute Engine token type. Restrict by service account instead."
+ });
+ }
+ }
+
if (data.method === "kubernetes") {
const isGatewayReviewer = data.tokenReviewMode === "gateway";
if (!isGatewayReviewer && !data.kubernetesHost.trim()) {
@@ -127,6 +160,16 @@ export const toNetworkingAuthMethodInput = (form: FormData) => {
};
}
+ if (form.method === "gcp") {
+ return {
+ method: "gcp" as const,
+ type: form.gcpAuthType,
+ allowedServiceAccounts: form.allowedServiceAccounts,
+ allowedProjects: form.allowedProjects,
+ allowedZones: form.allowedZones
+ };
+ }
+
if (form.method === "kubernetes") {
const isGatewayReviewer = form.tokenReviewMode === "gateway";
return {
@@ -158,6 +201,15 @@ type AuthMethod =
allowedAccountIds: string;
};
}
+ | {
+ method: "gcp";
+ config: {
+ type: "gce" | "iam";
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ };
+ }
| {
method: "kubernetes";
config: {
@@ -200,6 +252,7 @@ export const NetworkingAuthMethodForm = ({
const { isSubOrganization } = useOrganization();
const initialMethod: NetworkingAuthMethod = currentMethod.method;
const initialAws = currentMethod.method === "aws" ? currentMethod.config : undefined;
+ const initialGcp = currentMethod.method === "gcp" ? currentMethod.config : undefined;
const initialKubernetes =
currentMethod.method === "kubernetes" ? currentMethod.config : undefined;
const methodOptions = NETWORKING_AUTH_METHOD_OPTIONS.filter(({ value }) =>
@@ -210,6 +263,10 @@ export const NetworkingAuthMethodForm = ({
stsEndpoint: initialAws?.stsEndpoint ?? "https://sts.amazonaws.com/",
allowedPrincipalArns: initialAws?.allowedPrincipalArns ?? "",
allowedAccountIds: initialAws?.allowedAccountIds ?? "",
+ gcpAuthType: initialGcp?.type ?? "gce",
+ allowedServiceAccounts: initialGcp?.allowedServiceAccounts ?? "",
+ allowedProjects: initialGcp?.allowedProjects ?? "",
+ allowedZones: initialGcp?.allowedZones ?? "",
kubernetesHost: initialKubernetes?.kubernetesHost ?? "",
caCertificate: initialKubernetes?.caCertificate ?? "",
tokenReviewerJwt: "",
@@ -244,6 +301,10 @@ export const NetworkingAuthMethodForm = ({
initialAws?.stsEndpoint,
initialAws?.allowedPrincipalArns,
initialAws?.allowedAccountIds,
+ initialGcp?.type,
+ initialGcp?.allowedServiceAccounts,
+ initialGcp?.allowedProjects,
+ initialGcp?.allowedZones,
initialKubernetes?.kubernetesHost,
initialKubernetes?.allowedNamespaces,
initialKubernetes?.allowedNames,
@@ -259,6 +320,7 @@ export const NetworkingAuthMethodForm = ({
const method = watch("method");
const isSaving = isSubmitting || isPending;
const verifyTlsCertificate = watch("verifyTlsCertificate");
+ const gcpAuthType = watch("gcpAuthType");
const tokenReviewMode = watch("tokenReviewMode");
const gatewayId = watch("gatewayId");
const gatewayPoolId = watch("gatewayPoolId");
@@ -365,6 +427,148 @@ export const NetworkingAuthMethodForm = ({
</>
)}
+ {method === "gcp" && (
+ <>
+ <Controller
+ control={control}
+ name="gcpAuthType"
+ render={({ field }) => (
+ <Field>
+ <FieldLabel className="inline-flex items-center gap-1.5">
+ Type
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ GCP ID Token Auth reads an identity token from the instance metadata server,
+ which covers Compute Engine VMs and GKE workload identity. GCP IAM Auth signs
+ a token through the IAM Credentials API, for hosts outside Compute Engine.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <FilterableSelect
+ value={GCP_AUTH_TYPE_OPTIONS.find((option) => option.value === field.value)}
+ onChange={(option) => {
+ const next = option as { value: "gce" | "iam" } | null;
+ if (next) field.onChange(next.value);
+ }}
+ options={GCP_AUTH_TYPE_OPTIONS}
+ isDisabled={isDisabled || isSaving}
+ isSearchable={false}
+ isClearable={false}
+ getOptionLabel={(option) => option.label}
+ getOptionValue={(option) => option.value}
+ />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="allowedServiceAccounts"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel className="inline-flex items-center gap-1.5">
+ Allowed Service Account Emails (optional)
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ A comma-separated list of service account emails. A login is accepted when the
+ service account in the token matches one of them.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ disabled={isDisabled || isSaving}
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ {gcpAuthType === "gce" && (
+ <>
+ <Controller
+ control={control}
+ name="allowedProjects"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel className="inline-flex items-center gap-1.5">
+ Allowed Projects (optional)
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ A comma-separated list of GCP project IDs whose Compute Engine instances
+ may authenticate as this gateway. Every instance in the project is
+ trusted, so prefer a service account where you can.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ disabled={isDisabled || isSaving}
+ isError={Boolean(error)}
+ placeholder="my-gcp-project, ..."
+ />
+ <FieldDescription>
+ Checked against the Compute Engine details in the token. A GKE workload
+ identity token does not carry them, so leave this empty for GKE.
+ </FieldDescription>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="allowedZones"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel className="inline-flex items-center gap-1.5">
+ Allowed Zones (optional)
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <InfoIcon className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-md">
+ A comma-separated list of GCP zones whose Compute Engine instances may
+ authenticate as this gateway.
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ disabled={isDisabled || isSaving}
+ isError={Boolean(error)}
+ placeholder="us-west2-a, us-central1-a, ..."
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ </>
+ )}
+ <p className="text-xs text-muted">
+ {gcpAuthType === "gce"
+ ? "Allowed service account emails or allowed projects is required. Zones only narrow one of those."
+ : "Allowed service account emails is required."}
+ </p>
+ </>
+ )}
+
{method === "kubernetes" && (
<>
<Controller
diff --git a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodLabel.tsx b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodLabel.tsx
index c40f148130..9ff280c8a6 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodLabel.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodLabel.tsx
@@ -5,7 +5,7 @@ import {
} from "react-select";
import { CheckIcon, KeyIcon } from "lucide-react";
-export type NetworkingAuthMethod = "aws" | "kubernetes" | "token";
+export type NetworkingAuthMethod = "aws" | "gcp" | "kubernetes" | "token";
export type NetworkingAuthMethodOption = {
value: NetworkingAuthMethod;
@@ -15,6 +15,7 @@ export type NetworkingAuthMethodOption = {
export const NETWORKING_AUTH_METHOD_OPTIONS: NetworkingAuthMethodOption[] = [
{ value: "token", label: "Token Auth" },
{ value: "aws", label: "AWS Auth" },
+ { value: "gcp", label: "GCP Auth" },
{ value: "kubernetes", label: "Kubernetes Auth" }
];
@@ -29,6 +30,16 @@ const NetworkingAuthMethodIcon = ({ method }: { method: NetworkingAuthMethod })
/>
);
}
+ if (method === "gcp") {
+ return (
+ <img
+ src="/images/integrations/Google Cloud Platform.png"
+ alt=""
+ aria-hidden
+ className="size-4 object-contain"
+ />
+ );
+ }
if (method === "kubernetes") {
return (
<img
diff --git a/helm-charts/infisical-gateway/CHANGELOG.md b/helm-charts/infisical-gateway/CHANGELOG.md
index d867427588..0fd6b7e5ae 100644
--- a/helm-charts/infisical-gateway/CHANGELOG.md
+++ b/helm-charts/infisical-gateway/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 1.6.0 (Unreleased)
+* Added GCP auth enrollment (`gateway.enrollment.method: gcp`). The gateway proves its identity with a token from the GCP metadata server, so no credential is distributed to the cluster or the VM.
+* Added `gateway.enrollment.gcp.gatewayId`, `gateway.enrollment.gcp.type` and `gateway.enrollment.gcp.serviceAccountKeyFilePath`.
+* The default CLI image must be bumped to the first release containing `--enroll-method=gcp` before this chart version is published. Until then, `gateway.enrollment.method: gcp` crash-loops the pod on `unknown flag: --gcp-auth-type`.
+
## 1.5.0 (September 7, 2026)
* Added `gateway.listenAddress`, a `host:port` that Infisical dials to reach the gateway, which runs it in direct listen mode instead of connecting out to a relay. Leave it empty for relay mode.
* The container port and the Service's `targetPort` are both derived from `gateway.listenAddress`, so they cannot drift from the port the gateway binds. A malformed value fails the render.
diff --git a/helm-charts/infisical-gateway/Chart.yaml b/helm-charts/infisical-gateway/Chart.yaml
index 9eb2180750..d3e9754854 100644
--- a/helm-charts/infisical-gateway/Chart.yaml
+++ b/helm-charts/infisical-gateway/Chart.yaml
@@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 1.5.0
+version: 1.6.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
diff --git a/helm-charts/infisical-gateway/templates/deployment.yaml b/helm-charts/infisical-gateway/templates/deployment.yaml
index 1b45eb938d..f64042e903 100644
--- a/helm-charts/infisical-gateway/templates/deployment.yaml
+++ b/helm-charts/infisical-gateway/templates/deployment.yaml
@@ -10,6 +10,15 @@
{{- end }}
{{- end }}
{{- end }}
+{{- if eq .Values.gateway.enrollment.method "gcp" }}
+ {{- $gcpType := .Values.gateway.enrollment.gcp.type | default "gce" }}
+ {{- if not (has $gcpType (list "gce" "iam")) }}
+ {{- fail (printf "gateway.enrollment.gcp.type must be 'gce' or 'iam', got '%s'." $gcpType) }}
+ {{- end }}
+ {{- if and .Values.gateway.enrollment.gcp.serviceAccountKeyFilePath (ne $gcpType "iam") }}
+ {{- fail "gateway.enrollment.gcp.serviceAccountKeyFilePath only applies when gateway.enrollment.gcp.type is 'iam'. The gce type reads its token from the instance metadata server." }}
+ {{- end }}
+{{- end }}
{{- if eq .Values.gateway.enrollment.method "token" }}
{{- if not .Values.persistence.enabled }}
{{- fail "persistence.enabled must be true when gateway.enrollment.method is 'token'. The enrollment token is single-use and credentials must persist across pod restarts." }}
@@ -115,6 +124,15 @@ spec:
{{- if eq .Values.gateway.enrollment.method "aws" }}
- --gateway-id={{ required "gateway.enrollment.aws.gatewayId is required when gateway.enrollment.method is 'aws'" .Values.gateway.enrollment.aws.gatewayId }}
{{- end }}
+ {{- if eq .Values.gateway.enrollment.method "gcp" }}
+ - --gateway-id={{ required "gateway.enrollment.gcp.gatewayId is required when gateway.enrollment.method is 'gcp'" .Values.gateway.enrollment.gcp.gatewayId }}
+ {{- if .Values.gateway.enrollment.gcp.type }}
+ - --gcp-auth-type={{ .Values.gateway.enrollment.gcp.type }}
+ {{- end }}
+ {{- if .Values.gateway.enrollment.gcp.serviceAccountKeyFilePath }}
+ - --service-account-key-file-path={{ .Values.gateway.enrollment.gcp.serviceAccountKeyFilePath }}
+ {{- end }}
+ {{- end }}
{{- if eq .Values.gateway.enrollment.method "kubernetes" }}
- --gateway-id={{ required "gateway.enrollment.kubernetes.gatewayId is required when gateway.enrollment.method is 'kubernetes'" .Values.gateway.enrollment.kubernetes.gatewayId }}
{{- if .Values.gateway.enrollment.kubernetes.serviceAccountTokenPath }}
diff --git a/helm-charts/infisical-gateway/values.yaml b/helm-charts/infisical-gateway/values.yaml
index e740b8b64a..afc235c190 100644
--- a/helm-charts/infisical-gateway/values.yaml
+++ b/helm-charts/infisical-gateway/values.yaml
@@ -17,7 +17,7 @@ gateway:
domain: ""
enrollment:
- # Enrollment method: "token", "aws", or "kubernetes".
+ # Enrollment method: "token", "aws", "gcp", or "kubernetes".
# Leave empty to use the legacy machine identity flow (env vars from secret.name).
method: ""
@@ -35,6 +35,18 @@ gateway:
# Required when method=aws. Gateway ID from the Infisical UI.
gatewayId: ""
+ # GCP enrollment settings (method=gcp)
+ gcp:
+ # Required when method=gcp. Gateway ID from the Infisical UI.
+ gatewayId: ""
+ # How the gateway proves its GCP identity: "gce" reads an identity token from the instance
+ # metadata server, which covers GKE workload identity; "iam" signs a JWT through the IAM
+ # Credentials API. Leave empty for the CLI default of "gce".
+ type: ""
+ # Only for type=iam, and only when the pod has no workload identity to sign with. Path to a
+ # service account key file, which you must mount yourself.
+ serviceAccountKeyFilePath: ""
+
# Kubernetes enrollment settings (method=kubernetes).
kubernetes:
# Required when method=kubernetes. Gateway ID from the Infisical UI.
@@ -63,7 +75,7 @@ gateway:
# Persistent storage for the gateway (credentials and session recordings).
# Required when enrollment.method=token so credentials survive pod restarts.
-# Optional when enrollment.method=aws or enrollment.method=kubernetes, since both re-authenticate
+# Optional when enrollment.method is aws, gcp or kubernetes, since all three re-authenticate
# on every start.
# For legacy machine-identity installs (no enrollment.method), persistence only takes effect
# when existingClaim is provided.