diff --git a/backend/src/services/app-connection/github/github-connection-fns.ts b/backend/src/services/app-connection/github/github-connection-fns.ts index b86e2ed65..b38b9406b 100644 --- a/backend/src/services/app-connection/github/github-connection-fns.ts +++ b/backend/src/services/app-connection/github/github-connection-fns.ts @@ -10,6 +10,7 @@ import { request as httpRequest } from "@app/lib/config/request"; import { BadRequestError, ForbiddenRequestError, InternalServerError } from "@app/lib/errors"; import { GatewayProxyProtocol, withGatewayProxy } from "@app/lib/gateway"; import { logger } from "@app/lib/logger"; +import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator"; import { getAppConnectionMethodName } from "@app/services/app-connection/app-connection-fns"; import { IntegrationUrls } from "@app/services/integration-auth/integration-list"; @@ -30,7 +31,7 @@ export const getGitHubConnectionListItem = () => { }; export const requestWithGitHubGateway = async ( - appConnection: { gatewayId?: string | null; credentials: { host?: string } }, + appConnection: { gatewayId?: string | null }, gatewayService: Pick, requestConfig: AxiosRequestConfig ): Promise> => { @@ -43,6 +44,8 @@ export const requestWithGitHubGateway = async ( const url = new URL(requestConfig.url as string); + await blockLocalAndPrivateIpAddresses(url.toString()); + const [targetHost] = await verifyHostInputValidity(url.host, true); const relayDetails = await gatewayService.fnGetGatewayClientTlsByGatewayId(gatewayId); const [relayHost, relayPort] = relayDetails.relayAddress.split(":");