Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
refactor(gateway): expose the reviewer gateway as gatewayId
bernie-g0d7862e83f32
diff --git a/backend/src/ee/routes/v3/gateway-router.ts b/backend/src/ee/routes/v3/gateway-router.tsindex 734822ef54..42ef17c716 100644--- a/backend/src/ee/routes/v3/gateway-router.ts+++ b/backend/src/ee/routes/v3/gateway-router.ts@@ -71,7 +71,7 @@ const KubernetesAuthMethodInputSchema = z.nativeEnum(KubernetesTokenReviewMode).default(KubernetesTokenReviewMode.Api).describe(GATEWAYS.AUTH_METHOD.tokenReviewMode),- gatewayV2Id: z.string().uuid().nullable().optional().describe(GATEWAYS.AUTH_METHOD.gatewayV2Id),+ gatewayId: z.string().uuid().nullable().optional().describe(GATEWAYS.AUTH_METHOD.gatewayId),gatewayPoolId: z.string().uuid().nullable().optional().describe(GATEWAYS.AUTH_METHOD.gatewayPoolId),allowedNamespaces: validateAllowedNamespaces.describe(GATEWAYS.AUTH_METHOD.allowedNamespaces),allowedNames: validateAllowedNames.describe(GATEWAYS.AUTH_METHOD.allowedNames),@@ -82,13 +82,13 @@ const KubernetesAuthMethodInputSchema = zmessage: "At least one of allowedNamespaces or allowedNames must be set",path: ["allowedNamespaces"]})- .refine((data) => !(data.gatewayV2Id && data.gatewayPoolId), {+ .refine((data) => !(data.gatewayId && data.gatewayPoolId), {message: "Select either a gateway or a gateway pool to review tokens, not both",path: ["gatewayPoolId"]})- .refine((data) => data.tokenReviewMode !== KubernetesTokenReviewMode.Gateway || Boolean(data.gatewayV2Id), {+ .refine((data) => data.tokenReviewMode !== KubernetesTokenReviewMode.Gateway || Boolean(data.gatewayId), {message: "Gateway review mode requires a specific gateway to perform the review",- path: ["gatewayV2Id"]+ path: ["gatewayId"]})// In this mode the selected gateway supplies the TokenReview verdict, so it is the attestor for// every login. Pool membership can change afterwards under a different permission, which would@@ -138,7 +138,7 @@ const toCreateAuthMethodArg = (input: TSettableAuthMethodInput) => {caCertificate: input.caCertificate,tokenReviewerJwt: input.tokenReviewerJwt,tokenReviewMode: input.tokenReviewMode,- gatewayV2Id: input.gatewayV2Id,+ gatewayV2Id: input.gatewayId,gatewayPoolId: input.gatewayPoolId,allowedNamespaces: input.allowedNamespaces,allowedNames: input.allowedNames,@@ -166,7 +166,7 @@ const toSetAuthMethodArg = (input: TSettableAuthMethodInput) => {caCertificate: input.caCertificate,tokenReviewerJwt: input.tokenReviewerJwt,tokenReviewMode: input.tokenReviewMode,- gatewayV2Id: input.gatewayV2Id,+ gatewayV2Id: input.gatewayId,gatewayPoolId: input.gatewayPoolId,allowedNamespaces: input.allowedNamespaces,allowedNames: input.allowedNames,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.tsindex 17b026ee2f..b9b6fd9b11 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@@ -15,7 +15,7 @@ export const KubernetesAuthMethodConfigSchema = z.object({id: z.string().uuid(),kubernetesHost: z.string(),tokenReviewMode: z.string(),- gatewayV2Id: z.string().nullable(),+ gatewayId: z.string().nullable(),gatewayPoolId: z.string().nullable(),allowedNamespaces: z.string(),allowedNames: z.string(),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.tsindex b0a8f425a2..6f202100b6 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@@ -317,7 +317,7 @@ export const resourceAuthMethodServiceFactory = ({id: config.id,kubernetesHost: config.kubernetesHost ?? "",tokenReviewMode: config.tokenReviewMode,- gatewayV2Id: config.gatewayV2Id ?? null,+ gatewayId: config.gatewayV2Id ?? null,gatewayPoolId: config.gatewayPoolId ?? null,allowedNamespaces: config.allowedNamespaces,allowedNames: config.allowedNames,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.tsindex e6928ce6bb..90fa03b200 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@@ -38,7 +38,7 @@ export type TKubernetesAuthMethodConfigView = Omit<// Always present on read, empty when the review runs through a gateway's own service account.kubernetesHost: string;tokenReviewMode: string;- gatewayV2Id: string | null;+ gatewayId: string | null;gatewayPoolId: string | null;caCertificate: string;hasTokenReviewerJwt: boolean;diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex b9e3a0b494..a429228afc 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -3808,10 +3808,10 @@ export const GATEWAYS = {"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:"Who performs the TokenReview. 'api' means Infisical does, using the configured token reviewer JWT. 'gateway' means the selected gateway does, using its own in-cluster service account, which requires no Kubernetes host or reviewer token but requires that gateway to run as a pod in the cluster.",- gatewayV2Id:+ gatewayId:"The gateway to route TokenReview traffic through, for clusters whose API server Infisical cannot reach. Must be a different gateway that is already enrolled and connected. Mutually exclusive with gatewayPoolId.",gatewayPoolId:- "The gateway pool to route TokenReview traffic through. Any healthy member performs the request, so this survives a single gateway going offline. Mutually exclusive with gatewayV2Id.",+ "The gateway pool to route TokenReview traffic through. Any healthy member performs the request, so this survives a single gateway going offline. Mutually exclusive with gatewayId.",caCertificate:"The PEM-encoded CA certificate that issued the Kubernetes API server's TLS certificate. Required when the API server uses a certificate the system trust store does not recognise, which is the usual case for a cluster CA.",tokenReviewerJwt:diff --git a/frontend/src/hooks/api/gateways-v2/types.ts b/frontend/src/hooks/api/gateways-v2/types.tsindex 3e4c141c9d..ac56b51b02 100644--- a/frontend/src/hooks/api/gateways-v2/types.ts+++ b/frontend/src/hooks/api/gateways-v2/types.ts@@ -34,7 +34,7 @@ export type GatewayKubernetesAuthConfig = {caCertificate: string;hasTokenReviewerJwt: boolean;tokenReviewMode: string;- gatewayV2Id: string | null;+ gatewayId: string | null;gatewayPoolId: string | null;createdAt: string;updatedAt: string;@@ -72,7 +72,7 @@ export type SettableAuthMethodInput =// Write-only. Omitted means "keep the stored value"; an empty string clears it.tokenReviewerJwt?: string;tokenReviewMode?: string;- gatewayV2Id?: string | null;+ gatewayId?: string | null;gatewayPoolId?: string | null;allowedNamespaces: string;allowedNames: string;diff --git a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsxindex 6717cff3c9..143d2812fc 100644--- a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx+++ b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx@@ -50,7 +50,7 @@ const schema = z// host and no reviewer token but requires that gateway to run as a pod in the cluster.tokenReviewMode: z.enum(["api", "gateway"]),// Empty string means "no proxy": review straight from Infisical. Only one may be set.- gatewayV2Id: z.string(),+ gatewayId: z.string(),gatewayPoolId: z.string(),// True once Reset is clicked, which swaps the stored token for an editable field. Saving with// that field empty is what removes the token, since a never-returned value cannot be blanked.@@ -84,10 +84,10 @@ const schema = zmessage: "Kubernetes host is required"});}- if (isGatewayReviewer && !data.gatewayV2Id) {+ if (isGatewayReviewer && !data.gatewayId) {ctx.addIssue({code: z.ZodIssueCode.custom,- path: ["gatewayV2Id"],+ path: ["gatewayId"],message: "Select a specific gateway to perform the review; a pool cannot"});}@@ -134,7 +134,7 @@ export const toNetworkingAuthMethodInput = (form: FormData) => {// The gateway resolves its own API server, so sending a host would be meaningless.kubernetesHost: isGatewayReviewer ? undefined : form.kubernetesHost,tokenReviewMode: form.tokenReviewMode,- gatewayV2Id: form.gatewayV2Id || null,+ gatewayId: form.gatewayId || null,gatewayPoolId: form.gatewayPoolId || null,caCertificate: form.caCertificate,// Write-only: undefined keeps the stored value, empty string removes it.@@ -169,7 +169,7 @@ type AuthMethod =caCertificate: string;hasTokenReviewerJwt: boolean;tokenReviewMode: string;- gatewayV2Id: string | null;+ gatewayId: string | null;gatewayPoolId: string | null;};}@@ -218,7 +218,7 @@ export const NetworkingAuthMethodForm = ({allowedAudience: initialKubernetes?.allowedAudience ?? "",verifyTlsCertificate: initialKubernetes?.verifyTlsCertificate ?? true,tokenReviewMode: initialKubernetes?.tokenReviewMode === "gateway" ? "gateway" : "api",- gatewayV2Id: initialKubernetes?.gatewayV2Id ?? "",+ gatewayId: initialKubernetes?.gatewayId ?? "",gatewayPoolId: initialKubernetes?.gatewayPoolId ?? "",resetTokenReviewerJwt: false};@@ -251,7 +251,7 @@ export const NetworkingAuthMethodForm = ({initialKubernetes?.verifyTlsCertificate,initialKubernetes?.caCertificate,initialKubernetes?.tokenReviewMode,- initialKubernetes?.gatewayV2Id,+ initialKubernetes?.gatewayId,initialKubernetes?.gatewayPoolId,reset]);@@ -260,9 +260,9 @@ export const NetworkingAuthMethodForm = ({const isSaving = isSubmitting || isPending;const verifyTlsCertificate = watch("verifyTlsCertificate");const tokenReviewMode = watch("tokenReviewMode");- const gatewayV2Id = watch("gatewayV2Id");+ const gatewayId = watch("gatewayId");const gatewayPoolId = watch("gatewayPoolId");- const isProxied = Boolean(gatewayV2Id || gatewayPoolId);+ const isProxied = Boolean(gatewayId || gatewayPoolId);const isGatewayReviewer = tokenReviewMode === "gateway";const isTokenReviewerJwtConfigured =Boolean(initialKubernetes?.hasTokenReviewerJwt) && !watch("resetTokenReviewerJwt");@@ -369,7 +369,7 @@ export const NetworkingAuthMethodForm = ({<><Controllercontrol={control}- name="gatewayV2Id"+ name="gatewayId"render={({ field, fieldState: { error } }) => (<Field><FieldLabel className="inline-flex items-center gap-1.5">@@ -389,7 +389,7 @@ export const NetworkingAuthMethodForm = ({<GatewayPickervalue={{ gatewayId: field.value || null, gatewayPoolId: gatewayPoolId || null }}onChange={(next) => {- setValue("gatewayV2Id", next.gatewayId ?? "", { shouldDirty: true });+ setValue("gatewayId", next.gatewayId ?? "", { shouldDirty: true });setValue("gatewayPoolId", next.gatewayPoolId ?? "", { shouldDirty: true });// Without a proxy there is nobody to hand the review to.if (!next.gatewayId && !next.gatewayPoolId) {