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
fix(gateways): narrow listed gateways to v2 before reading transports
bernie-g1d1bb13e10fa
diff --git a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsxindex 883ee7b0f6..bba9e824ec 100644--- a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx+++ b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx@@ -8,7 +8,7 @@ import {OrgPermissionSubjects} from "@app/context/OrgPermissionContext/types";import { gatewayPoolsQueryKeys } from "@app/hooks/api/gateway-pools/queries";-import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";+import { gatewaysQueryKeys, isListedGatewayV2 } from "@app/hooks/api/gateways/queries";import { isGatewayHealthy } from "@app/hooks/api/gateways-v2/utils";import { PoolHealthBadge } from "@app/pages/organization/NetworkingPage/components/GatewayTab/components/PoolHealthBadge";@@ -88,7 +88,8 @@ export const GatewayPicker = ({}};- const v2Gateways = gateways?.filter((g) => !g.isV1 && g.id !== excludeGatewayId) ?? [];+ const v2Gateways =+ gateways?.filter(isListedGatewayV2).filter((g) => g.id !== excludeGatewayId) ?? [];const isOnline = (gw: (typeof v2Gateways)[number]) => isGatewayHealthy(gw);diff --git a/frontend/src/hooks/api/gateways/queries.tsx b/frontend/src/hooks/api/gateways/queries.tsxindex 4af8234145..2ec34350bc 100644--- a/frontend/src/hooks/api/gateways/queries.tsx+++ b/frontend/src/hooks/api/gateways/queries.tsx@@ -5,6 +5,15 @@ import { apiRequest } from "@app/config/request";import { TGatewayV2 } from "../gateways-v2/types";import { TGateway } from "./types";+export type TListedGatewayV1 = TGateway & { isV1: true };+export type TListedGatewayV2 = TGatewayV2 & { isV1: false };+export type TListedGateway = TListedGatewayV1 | TListedGatewayV2;++// A type predicate, so the narrowing survives a .filter(). A plain `!g.isV1` callback returns the+// union unchanged, which is how v1 gateways reached helpers that only accept the v2 shape.+export const isListedGatewayV2 = (gateway: TListedGateway): gateway is TListedGatewayV2 =>+ !gateway.isV1;+export const gatewaysQueryKeys = {allKey: () => ["gateways"],listKey: () => [...gatewaysQueryKeys.allKey(), "list"],diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsxindex e24e2506a0..5cbf0d8d6a 100644--- a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx@@ -8,13 +8,13 @@ import {AlertTitle,Badge,Button,- Checkbox,Card,CardAction,CardContent,CardDescription,CardHeader,CardTitle,+ Checkbox,DocumentationLinkBadge,Field,FieldContent,diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsxindex 599a543e88..7a2d2ae21e 100644--- a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx@@ -76,11 +76,14 @@ export const GatewayDetailsCard = ({ gateway }: { gateway: TGatewayV2WithAuthMetconst { authMethod } = gateway;const isIdentityGateway = authMethod.method === "identity";const effectiveHeartbeat = getLastSeenHeartbeat(gateway);- const connection = gateway.directAddress- ? `${gateway.relayId ? "Direct + Relay" : "Direct"} (${gateway.directAddress})`- : gateway.relayId- ? "Relay"- : "Not configured";+ const describeConnection = () => {+ if (gateway.directAddress) {+ const mode = gateway.relayId ? "Direct + Relay" : "Direct";+ return `${mode} (${gateway.directAddress})`;+ }+ return gateway.relayId ? "Relay" : "Not configured";+ };+ const connection = describeConnection();// Only broken out for a gateway running both. With one transport the Health badge and Last Seen// above already say everything these rows would.const transportHealth = getGatewayTransportHealth(gateway);diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/PoolDetailSheet.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/PoolDetailSheet.tsxindex d00a961f73..c0b77ae98f 100644--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/PoolDetailSheet.tsx+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/PoolDetailSheet.tsx@@ -47,7 +47,7 @@ import {import { usePopUp } from "@app/hooks";import { useAddGatewayToPool, useRemoveGatewayFromPool } from "@app/hooks/api/gateway-pools";import { TGatewayPool } from "@app/hooks/api/gateway-pools/types";-import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";+import { gatewaysQueryKeys, isListedGatewayV2 } from "@app/hooks/api/gateways/queries";import { useTriggerGatewayV2Heartbeat } from "@app/hooks/api/gateways-v2";import { isGatewayHealthy } from "@app/hooks/api/gateways-v2/utils";@@ -228,7 +228,7 @@ export const PoolDetailSheet = ({ isOpen, onOpenChange, pool }: Props) => {</TableRow>)}{memberGateways.map((gw) => {- const isOnline = isGatewayHealthy(gw);+ const isOnline = isListedGatewayV2(gw) && isGatewayHealthy(gw);return (<TableRow key={gw.id}>