Skip to content

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

fix(gateway): require a specific gateway as the Kubernetes token attestor

bernie-ged468da891ef
diff --git a/backend/src/ee/routes/v3/gateway-router.ts b/backend/src/ee/routes/v3/gateway-router.ts
index e5abac9778..734822ef54 100644
--- a/backend/src/ee/routes/v3/gateway-router.ts
+++ b/backend/src/ee/routes/v3/gateway-router.ts
@@ -86,13 +86,18 @@ const KubernetesAuthMethodInputSchema = z
message: "Select either a gateway or a gateway pool to review tokens, not both",
path: ["gatewayPoolId"]
})
- .refine(
- (data) => data.tokenReviewMode !== KubernetesTokenReviewMode.Gateway || data.gatewayV2Id || data.gatewayPoolId,
- {
- message: "Gateway review mode requires a gateway or gateway pool to perform the review",
- path: ["gatewayV2Id"]
- }
- )
+ .refine((data) => data.tokenReviewMode !== KubernetesTokenReviewMode.Gateway || Boolean(data.gatewayV2Id), {
+ message: "Gateway review mode requires a specific gateway to perform the review",
+ path: ["gatewayV2Id"]
+ })
+ // 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
+ // let a pool editor add a gateway they control and have it authenticate as this one.
+ .refine((data) => data.tokenReviewMode !== KubernetesTokenReviewMode.Gateway || !data.gatewayPoolId, {
+ message:
+ "A gateway pool cannot perform the review, because its membership can change after this is saved. Select a specific gateway.",
+ path: ["gatewayPoolId"]
+ })
// Only gateway review mode can go without a host, because there the gateway calls its own
// API server rather than an address we supply.
.refine((data) => data.tokenReviewMode === KubernetesTokenReviewMode.Gateway || Boolean(data.kubernetesHost), {
diff --git a/docs/documentation/platform/gateways/gateway-deployment.mdx b/docs/documentation/platform/gateways/gateway-deployment.mdx
index 01c08d66bb..acd5d7233f 100644
--- a/docs/documentation/platform/gateways/gateway-deployment.mdx
+++ b/docs/documentation/platform/gateways/gateway-deployment.mdx
@@ -182,7 +182,7 @@ This guide covers everything you need to deploy and configure Infisical Gateways
| **Gateway as Reviewer** | The selected gateway, using its own service account | That gateway runs as a pod in the same cluster. No host or reviewer token needed. |
| **Manual Token Reviewer JWT (API)** | Infisical, tunnelling through the gateway | A Kubernetes host and a reviewer token. Works from any gateway that can reach the API server, including one on a VM in the same network. |
- Prefer a gateway pool over a single gateway. Any healthy member performs the check, so one gateway going offline does not stop the others from authenticating.
+ A gateway pool can only be used with **Manual Token Reviewer JWT (API)**, where any healthy member performs the check and one gateway going offline does not stop the others from authenticating. **Gateway as Reviewer** requires a specific gateway, because in that mode the selected gateway decides the outcome and pool membership can change after the config is saved.
<Warning>
A gateway cannot 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.
diff --git a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx
index 3ff329faec..6717cff3c9 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/NetworkingAuthMethodForm.tsx
@@ -84,11 +84,11 @@ const schema = z
message: "Kubernetes host is required"
});
}
- if (isGatewayReviewer && !data.gatewayV2Id && !data.gatewayPoolId) {
+ if (isGatewayReviewer && !data.gatewayV2Id) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["gatewayV2Id"],
- message: "Select the gateway or pool that will perform the review"
+ message: "Select a specific gateway to perform the review; a pool cannot"
});
}
if (!data.allowedNamespaces.trim() && !data.allowedNames.trim()) {