Skip to content

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

Refactor: Remove redundant IP address blocking calls

Akhil Mohand1c360829604
diff --git a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
index ddfd4b0851..9aaf412c3c 100644
--- a/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
+++ b/backend/src/services/app-connection/hc-vault/hc-vault-connection-fns.ts
@@ -106,8 +106,6 @@ const createConcurrencyLimiter = (limit: number) => {
export const getHCVaultInstanceUrl = async (config: THCVaultConnectionConfig) => {
const instanceUrl = removeTrailingSlash(config.credentials.instanceUrl);
- await blockLocalAndPrivateIpAddresses(instanceUrl);
-
return instanceUrl;
};
@@ -133,15 +131,14 @@ export const requestWithHCVaultGateway = async <T>(
): Promise<AxiosResponse<T>> => {
const { gatewayId } = appConnection;
+ const url = new URL(requestConfig.url as string);
+ await blockLocalAndPrivateIpAddresses(url.toString(), Boolean(gatewayId));
+
// If gateway isn't set up, don't proxy request
if (!gatewayId) {
return request.request(requestConfig);
}
- const url = new URL(requestConfig.url as string);
-
- await blockLocalAndPrivateIpAddresses(url.toString());
-
const [targetHost] = await verifyHostInputValidity({ host: url.hostname, isGateway: true, isDynamicSecret: false });
const relayDetails = await gatewayService.fnGetGatewayClientTlsByGatewayId(gatewayId);
const [relayHost, relayPort] = relayDetails.relayAddress.split(":");