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
Use safeRequest
Carlos Monastyrski0e235704c815
diff --git a/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts b/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.tsindex 902aa2df02..45782c9afe 100644--- a/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts+++ b/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts@@ -1,6 +1,4 @@import { TAuditLogs, TAuditLogStreams } from "@app/db/schemas";-import { getConfig } from "@app/lib/config/env";-import { blockLocalAndPrivateIpAddresses, createIpGuardedAgents } from "@app/lib/validator";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsDataKey } from "@app/services/kms/kms-types";@@ -14,11 +12,6 @@ import { getDatadogProviderListItem } from "./datadog/datadog-provider-fns";import { getSplunkProviderListItem } from "./splunk/splunk-provider-fns";import { getSumoLogicProviderListItem } from "./sumo-logic/sumo-logic-provider-fns";-export const blockAuditLogStreamInternalIps = (url: string) =>- blockLocalAndPrivateIpAddresses(url, false, getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP);--export const auditLogStreamAgents = createIpGuardedAgents(() => getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP);-// The instant a provider should report the event at. Delivery can lag the event by minutes// (retry backoff tops out around 240s) or by months during a backfill, so a provider that// stamps its own send time misdates the record. Falls back to now for payloads that carry nodiff --git a/backend/src/ee/services/audit-log-stream/azure/azure-provider-factory.ts b/backend/src/ee/services/audit-log-stream/azure/azure-provider-factory.tsindex b4e0ce37f7..bad432dc6c 100644--- a/backend/src/ee/services/audit-log-stream/azure/azure-provider-factory.ts+++ b/backend/src/ee/services/audit-log-stream/azure/azure-provider-factory.ts@@ -1,10 +1,11 @@import { RawAxiosRequestHeaders } from "axios";+import { getConfig } from "@app/lib/config/env";import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";+import { safeRequest } from "@app/lib/validator";import { AUDIT_LOG_STREAM_BATCH_TIMEOUT, AUDIT_LOG_STREAM_TIMEOUT } from "../../audit-log/audit-log-queue";-import { auditLogStreamAgents, blockAuditLogStreamInternalIps } from "../audit-log-stream-fns";import {TLogStreamFactoryBatchStreamLog,TLogStreamFactoryGetProviderBatchLimit,@@ -48,8 +49,6 @@ export const AzureProviderFactory = () => {}) => {const { tenantId, clientId, clientSecret, dceUrl, dcrId, cltName } = credentials;- await blockAuditLogStreamInternalIps(dceUrl);-const token = await getAzureToken(tenantId, clientId, clientSecret);const streamHeaders: RawAxiosRequestHeaders = {@@ -57,14 +56,14 @@ export const AzureProviderFactory = () => {Authorization: `Bearer ${token}`};- await request+ await safeRequest.post(`${dceUrl}/dataCollectionRules/${dcrId}/streams/Custom-${cltName}_CL?api-version=2023-01-01`,createPayload({ ping: "ok" }),{- ...auditLogStreamAgents,headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_TIMEOUT+ timeout: AUDIT_LOG_STREAM_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP}).catch((err) => {@@ -82,8 +81,6 @@ export const AzureProviderFactory = () => {const { tenantId, clientId, clientSecret, dceUrl, dcrId, cltName } = credentials;- await blockAuditLogStreamInternalIps(dceUrl);-const token = await getAzureToken(tenantId, clientId, clientSecret);const streamHeaders: RawAxiosRequestHeaders = {@@ -91,13 +88,13 @@ export const AzureProviderFactory = () => {Authorization: `Bearer ${token}`};- await request.post(+ await safeRequest.post(`${dceUrl}/dataCollectionRules/${dcrId}/streams/Custom-${cltName}_CL?api-version=2023-01-01`,auditLogs.map(buildAzureEvent),{- ...auditLogStreamAgents,headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT+ timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP});};diff --git a/backend/src/ee/services/audit-log-stream/cribl/cribl-provider-factory.ts b/backend/src/ee/services/audit-log-stream/cribl/cribl-provider-factory.tsindex 2921e132a6..d4549f66bd 100644--- a/backend/src/ee/services/audit-log-stream/cribl/cribl-provider-factory.ts+++ b/backend/src/ee/services/audit-log-stream/cribl/cribl-provider-factory.ts@@ -1,10 +1,10 @@import { RawAxiosRequestHeaders } from "axios";-import { request } from "@app/lib/config/request";+import { getConfig } from "@app/lib/config/env";import { BadRequestError } from "@app/lib/errors";+import { safeRequest } from "@app/lib/validator";import { AUDIT_LOG_STREAM_BATCH_TIMEOUT, AUDIT_LOG_STREAM_TIMEOUT } from "../../audit-log/audit-log-queue";-import { auditLogStreamAgents, blockAuditLogStreamInternalIps } from "../audit-log-stream-fns";import {TLogStreamFactoryBatchStreamLog,TLogStreamFactoryGetProviderBatchLimit,@@ -19,18 +19,16 @@ export const CriblProviderFactory = () => {}) => {const { url, token } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = {"Content-Type": "application/json",Authorization: `Bearer ${token}`};- await request+ await safeRequest.post(url, JSON.stringify({ ping: "ok" }), {- ...auditLogStreamAgents,headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_TIMEOUT+ timeout: AUDIT_LOG_STREAM_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP}).catch((err) => {throw new BadRequestError({ message: `Failed to connect with Cribl: ${(err as Error)?.message}` });@@ -48,8 +46,6 @@ export const CriblProviderFactory = () => {const { url, token } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = {"Content-Type": "application/x-ndjson",Authorization: `Bearer ${token}`@@ -57,27 +53,25 @@ export const CriblProviderFactory = () => {const body = auditLogs.map((auditLog) => JSON.stringify(auditLog)).join("\n");- await request.post(url, body, {- ...auditLogStreamAgents,+ await safeRequest.post(url, body, {headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT+ timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP});};const streamLog: TLogStreamFactoryStreamLog<TCriblProviderCredentials> = async ({ credentials, auditLog }) => {const { url, token } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = {"Content-Type": "application/json",Authorization: `Bearer ${token}`};- await request.post(url, JSON.stringify(auditLog), {- ...auditLogStreamAgents,+ await safeRequest.post(url, JSON.stringify(auditLog), {headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_TIMEOUT+ timeout: AUDIT_LOG_STREAM_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP});};diff --git a/backend/src/ee/services/audit-log-stream/custom/custom-provider-factory.ts b/backend/src/ee/services/audit-log-stream/custom/custom-provider-factory.tsindex b84ebc0deb..243967bbdb 100644--- a/backend/src/ee/services/audit-log-stream/custom/custom-provider-factory.ts+++ b/backend/src/ee/services/audit-log-stream/custom/custom-provider-factory.ts@@ -1,10 +1,10 @@import { RawAxiosRequestHeaders } from "axios";-import { request } from "@app/lib/config/request";+import { getConfig } from "@app/lib/config/env";import { BadRequestError } from "@app/lib/errors";+import { safeRequest } from "@app/lib/validator";import { AUDIT_LOG_STREAM_BATCH_TIMEOUT, AUDIT_LOG_STREAM_TIMEOUT } from "../../audit-log/audit-log-queue";-import { auditLogStreamAgents, blockAuditLogStreamInternalIps } from "../audit-log-stream-fns";import {TLogStreamFactoryBatchStreamLog,TLogStreamFactoryGetProviderBatchLimit,@@ -19,8 +19,6 @@ export const CustomProviderFactory = () => {}) => {const { url, headers } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = { "Content-Type": "application/json" };if (headers.length) {headers.forEach(({ key, value }) => {@@ -28,15 +26,14 @@ export const CustomProviderFactory = () => {});}- await request+ await safeRequest.post(url,{ ping: "ok" },{- ...auditLogStreamAgents,headers: streamHeaders,timeout: AUDIT_LOG_STREAM_TIMEOUT,- maxRedirects: 0+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP}).catch((err) => {@@ -54,8 +51,6 @@ export const CustomProviderFactory = () => {const { url, headers } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = { "Content-Type": "application/json" };if (headers.length) {@@ -64,18 +59,16 @@ export const CustomProviderFactory = () => {});}- await request.post(url, auditLogs, {- ...auditLogStreamAgents,+ await safeRequest.post(url, auditLogs, {headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT+ timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP});};const streamLog: TLogStreamFactoryStreamLog<TCustomProviderCredentials> = async ({ credentials, auditLog }) => {const { url, headers } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = { "Content-Type": "application/json" };if (headers.length) {@@ -84,10 +77,10 @@ export const CustomProviderFactory = () => {});}- await request.post(url, auditLog, {- ...auditLogStreamAgents,+ await safeRequest.post(url, auditLog, {headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_TIMEOUT+ timeout: AUDIT_LOG_STREAM_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP});};diff --git a/backend/src/ee/services/audit-log-stream/datadog/datadog-provider-factory.ts b/backend/src/ee/services/audit-log-stream/datadog/datadog-provider-factory.tsindex f271790c20..ed384794bb 100644--- a/backend/src/ee/services/audit-log-stream/datadog/datadog-provider-factory.ts+++ b/backend/src/ee/services/audit-log-stream/datadog/datadog-provider-factory.ts@@ -1,11 +1,10 @@import { RawAxiosRequestHeaders } from "axios";import { getConfig } from "@app/lib/config/env";-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";+import { safeRequest } from "@app/lib/validator";import { AUDIT_LOG_STREAM_BATCH_TIMEOUT, AUDIT_LOG_STREAM_TIMEOUT } from "../../audit-log/audit-log-queue";-import { auditLogStreamAgents, blockAuditLogStreamInternalIps } from "../audit-log-stream-fns";import {TLogStreamFactoryBatchStreamLog,TLogStreamFactoryGetProviderBatchLimit,@@ -33,15 +32,13 @@ export const DatadogProviderFactory = () => {}) => {const { url, token } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = { "Content-Type": "application/json", "DD-API-KEY": token };- await request+ await safeRequest.post(url, createPayload({ ping: "ok" }), {- ...auditLogStreamAgents,headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_TIMEOUT+ timeout: AUDIT_LOG_STREAM_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP}).catch((err) => {throw new BadRequestError({ message: `Failed to connect with Datadog: ${(err as Error)?.message}` });@@ -58,14 +55,12 @@ export const DatadogProviderFactory = () => {const { url, token } = credentials;- await blockAuditLogStreamInternalIps(url);-const streamHeaders: RawAxiosRequestHeaders = { "Content-Type": "application/json", "DD-API-KEY": token };- await request.post(url, auditLogs.map(createPayload), {- ...auditLogStreamAgents,+ await safeRequest.post(url, auditLogs.map(createPayload), {headers: streamHeaders,- timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT+ timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT,+ allowPrivateIps: getConfig().AUDIT_LOG_STREAM_ALLOW_INTERNAL_IP});};diff --git a/backend/src/ee/services/audit-log-stream/splunk/splunk-provider-factory.test.ts b/backend/src/ee/services/audit-log-stream/splunk/splunk-provider-factory.test.tsindex ee50a2ec44..0aa59a6335 100644--- a/backend/src/ee/services/audit-log-stream/splunk/splunk-provider-factory.test.ts+++ b/backend/src/ee/services/audit-log-stream/splunk/splunk-provider-factory.test.ts@@ -21,7 +21,6 @@ vi.mock("@app/lib/logger", () => ({// Only safeRequest's URL validation is stubbed, because the real one resolves DNS. The stub still// dispatches through the axios instance below, so the on-wire assertions stay on real behaviour.vi.mock("@app/lib/validator", () => ({- createIpGuardedAgents: () => ({}),safeRequest: {post: async (url: string, data: unknown, options: Record<string, unknown> = {}) => {const { allowPrivateIps, ...axiosOpts } = options;diff --git a/backend/src/ee/services/secret-rotation-v2/auth0-client-secret/auth0-client-secret-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/auth0-client-secret/auth0-client-secret-rotation-fns.tsindex 0c86d81121..20310eaee9 100644--- a/backend/src/ee/services/secret-rotation-v2/auth0-client-secret/auth0-client-secret-rotation-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/auth0-client-secret/auth0-client-secret-rotation-fns.ts@@ -12,10 +12,9 @@ import {TRotationFactoryRevokeCredentials,TRotationFactoryRotateCredentials} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { removeTrailingSlash } from "@app/lib/fn";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { getAuth0ConnectionAccessToken } from "@app/services/app-connection/auth0/auth0-connection-fns";import { generatePassword } from "../shared/utils";@@ -36,10 +35,9 @@ export const auth0ClientSecretRotationFactory: TRotationFactory<await blockLocalAndPrivateIpAddresses(audience);const clientSecret = generatePassword();- await request.request({+ await safeRequest.request({method: "PATCH",url: `${audience}clients/${clientId}`,- ...ipGuardedAgents,headers: { authorization: `Bearer ${accessToken}` },data: {client_secret: clientSecret@@ -66,10 +64,9 @@ export const auth0ClientSecretRotationFactory: TRotationFactory<await blockLocalAndPrivateIpAddresses(audience);// we just trigger an auth0 rotation to negate our credentials- await request.request({+ await safeRequest.request({method: "POST",url: `${audience}clients/${clientId}/rotate-secret`,- ...ipGuardedAgents,headers: { authorization: `Bearer ${accessToken}` }});@@ -110,10 +107,9 @@ export const auth0ClientSecretRotationFactory: TRotationFactory<await blockLocalAndPrivateIpAddresses(instanceUrl);try {- await request.request({+ await safeRequest.request({method: "POST",url: `${removeTrailingSlash(instanceUrl)}/oauth/token`,- ...ipGuardedAgents,headers: { "content-type": "application/x-www-form-urlencoded" },data: new URLSearchParams({grant_type: "client_credentials",diff --git a/backend/src/lib/validator/index.ts b/backend/src/lib/validator/index.tsindex 78b1e7bdd9..db8b80f9d7 100644--- a/backend/src/lib/validator/index.ts+++ b/backend/src/lib/validator/index.ts@@ -25,9 +25,6 @@ export {} from "./validate-smb";export {blockLocalAndPrivateIpAddresses,- createIpGuardedAgents,- ipGuardedAgents,- ipGuardedLookup,isValidAzureKeyVaultUrl,ssrfSafeGet,ssrfSafePost,diff --git a/backend/src/lib/validator/validate-url.ts b/backend/src/lib/validator/validate-url.tsindex f04f0fe4b6..fd87da021b 100644--- a/backend/src/lib/validator/validate-url.ts+++ b/backend/src/lib/validator/validate-url.ts@@ -1,8 +1,4 @@-import nodeDns, { LookupAddress } from "node:dns";import dns from "node:dns/promises";-import http from "node:http";-import https from "node:https";-import { LookupFunction } from "node:net";import { isIP } from "net";import RE2 from "re2";@@ -46,41 +42,6 @@ export const blockLocalAndPrivateIpAddresses = async (url: string, isGateway = fif (isInternalIp && !allowInternal) throw new BadRequestError({ message: "Local IPs not allowed as URL" });};-const createIpGuardedLookup =- (isInternalIpAllowed: () => boolean = () => false): LookupFunction =>- (hostname, options, callback) => {- nodeDns.lookup(hostname, { ...options, all: true }, (err, addresses: LookupAddress[]) => {- if (err) {- callback(err, "", 0);- return;- }- const appCfg = getConfig();- const isInternalAllowed =- appCfg.isDevelopmentMode || appCfg.ALLOW_INTERNAL_IP_CONNECTIONS || isInternalIpAllowed();- if (!isInternalAllowed && addresses.some(({ address }) => isPrivateIp(address))) {- callback(new BadRequestError({ message: "Local IPs not allowed as URL" }), "", 0);- return;- }- if (options.all) {- (callback as unknown as (error: null, result: LookupAddress[]) => void)(null, addresses);- return;- }- callback(null, addresses[0].address, addresses[0].family);- });- };--export const ipGuardedLookup = createIpGuardedLookup();--export const createIpGuardedAgents = (isInternalIpAllowed?: () => boolean) => {- const lookup = createIpGuardedLookup(isInternalIpAllowed);- return {- httpAgent: new http.Agent({ keepAlive: true, timeout: 5000, lookup }),- httpsAgent: new https.Agent({ keepAlive: true, timeout: 5000, lookup })- };-};--export const ipGuardedAgents = createIpGuardedAgents();-const AZURE_KEY_VAULT_HOST_REGEX = new RE2(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.vault\.azure\.net$/);/**diff --git a/backend/src/services/app-connection/1password/1password-connection-fns.ts b/backend/src/services/app-connection/1password/1password-connection-fns.tsindex e036d27bb2..07cb8c7fe6 100644--- a/backend/src/services/app-connection/1password/1password-connection-fns.ts+++ b/backend/src/services/app-connection/1password/1password-connection-fns.ts@@ -1,9 +1,8 @@import { AxiosError } from "axios";-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { removeTrailingSlash } from "@app/lib/fn";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { OnePassConnectionMethod } from "./1password-connection-enums";@@ -31,8 +30,7 @@ export const validateOnePassConnectionCredentials = async (config: TOnePassConneconst { apiToken } = config.credentials;try {- const res = await request.get(`${instanceUrl}/v1/vaults`, {- ...ipGuardedAgents,+ const res = await safeRequest.get(`${instanceUrl}/v1/vaults`, {headers: {Authorization: `Bearer ${apiToken}`,Accept: "application/json"@@ -60,8 +58,7 @@ export const listOnePassVaults = async (appConnection: TOnePassConnection) => {const instanceUrl = await getOnePassInstanceUrl(appConnection);const { apiToken } = appConnection.credentials;- const resp = await request.get<TOnePassVault[]>(`${instanceUrl}/v1/vaults`, {- ...ipGuardedAgents,+ const resp = await safeRequest.get<TOnePassVault[]>(`${instanceUrl}/v1/vaults`, {headers: {Authorization: `Bearer ${apiToken}`,Accept: "application/json"diff --git a/backend/src/services/app-connection/auth0/auth0-connection-fns.ts b/backend/src/services/app-connection/auth0/auth0-connection-fns.tsindex 5cde54eab6..16d0b8add4 100644--- a/backend/src/services/app-connection/auth0/auth0-connection-fns.ts+++ b/backend/src/services/app-connection/auth0/auth0-connection-fns.ts@@ -1,7 +1,6 @@-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { removeTrailingSlash } from "@app/lib/fn";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { encryptAppConnectionCredentials } from "@app/services/app-connection/app-connection-fns";@@ -27,10 +26,9 @@ const authorizeAuth0Connection = async ({const instanceUrl = domain.startsWith("http") ? domain : `https://${domain}`;await blockLocalAndPrivateIpAddresses(instanceUrl);- const { data } = await request.request<TAuth0AccessTokenResponse>({+ const { data } = await safeRequest.request<TAuth0AccessTokenResponse>({method: "POST",url: `${removeTrailingSlash(instanceUrl)}/oauth/token`,- ...ipGuardedAgents,headers: { "content-type": "application/x-www-form-urlencoded" },data: new URLSearchParams({grant_type: "client_credentials", // this will need to be resolved if we support methods other than client credentialsdiff --git a/backend/src/services/app-connection/auth0/auth0-connection-service.ts b/backend/src/services/app-connection/auth0/auth0-connection-service.tsindex 2e1a561da8..13a331395c 100644--- a/backend/src/services/app-connection/auth0/auth0-connection-service.ts+++ b/backend/src/services/app-connection/auth0/auth0-connection-service.ts@@ -1,6 +1,5 @@-import { request } from "@app/lib/config/request";import { OrgServiceActor } from "@app/lib/types";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { getAuth0ConnectionAccessToken } from "@app/services/app-connection/auth0/auth0-connection-fns";@@ -30,8 +29,7 @@ const listAuth0Clients = async (while (hasMore) {// eslint-disable-next-line no-await-in-loop- const { data: clientsPage } = await request.get<TAuth0ListClientsResponse>(`${audience}clients`, {- ...ipGuardedAgents,+ const { data: clientsPage } = await safeRequest.get<TAuth0ListClientsResponse>(`${audience}clients`, {headers: {Authorization: `Bearer ${accessToken}`,"Accept-Encoding": "application/json"diff --git a/backend/src/services/app-connection/azure-adcs/azure-adcs-connection-fns.ts b/backend/src/services/app-connection/azure-adcs/azure-adcs-connection-fns.tsindex baf8da737b..d45d05f100 100644--- a/backend/src/services/app-connection/azure-adcs/azure-adcs-connection-fns.ts+++ b/backend/src/services/app-connection/azure-adcs/azure-adcs-connection-fns.ts@@ -3,8 +3,9 @@ import { NtlmClient } from "axios-ntlm";import https from "https";import RE2 from "re2";+import { getConfig } from "@app/lib/config/env";import { BadRequestError, NotFoundError } from "@app/lib/errors";-import { blockLocalAndPrivateIpAddresses, ipGuardedLookup } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, buildSsrfSafeAgent } from "@app/lib/validator";import { decryptAppConnectionCredentials } from "@app/services/app-connection/app-connection-fns";import { TKmsServiceFactory } from "@app/services/kms/kms-service";@@ -105,19 +106,15 @@ const normalizeAdcsUrl = (url: string): string => {};// NTLM request wrapper-const createHttpsAgent = (sslRejectUnauthorized: boolean, sslCertificate?: string): https.Agent => {- const agentOptions: https.AgentOptions = {+const createHttpsAgent = async (url: string, sslRejectUnauthorized: boolean, sslCertificate?: string) =>+ (await buildSsrfSafeAgent(url, {rejectUnauthorized: sslRejectUnauthorized,keepAlive: true, // axios-ntlm needs keepAlive for NTLM handshakeca: sslCertificate ? [sslCertificate.trim()] : undefined,// Disable hostname verification as Microsoft servers by default use local IPs for certificates// which may not match the hostname used to connect- checkServerIdentity: () => undefined,- lookup: ipGuardedLookup- };-- return new https.Agent(agentOptions);-};+ checkServerIdentity: () => undefined+ })) as https.Agent;const axiosNtlmRequest = async (config: AxiosNtlmConfig): Promise<AxiosNtlmResponse> => {const method = config.method || "GET";@@ -132,6 +129,7 @@ const axiosNtlmRequest = async (config: AxiosNtlmConfig): Promise<AxiosNtlmRespoconst axiosConfig = {httpsAgent: config.httpsAgent,maxRedirects: 0,+ ...(getConfig().SAFE_REQUEST_FORCE_DIRECT_EGRESS && { proxy: false as const }),timeout: 60000};@@ -181,7 +179,7 @@ const testAdcsConnection = async (const shouldRejectUnauthorized = sslRejectUnauthorized;- const httpsAgent = createHttpsAgent(shouldRejectUnauthorized, sslCertificate);+ const httpsAgent = await createHttpsAgent(testUrl, shouldRejectUnauthorized, sslCertificate);const response = await axiosNtlmRequest({url: testUrl,@@ -295,7 +293,11 @@ const createNtlmClient = (get: async (endpoint: string, additionalHeaders: Record<string, string> = {}) => {const shouldRejectUnauthorized = sslRejectUnauthorized;- const httpsAgent = createHttpsAgent(shouldRejectUnauthorized, sslCertificate);+ const httpsAgent = await createHttpsAgent(+ `${normalizedUrl}${endpoint}`,+ shouldRejectUnauthorized,+ sslCertificate+ );return axiosNtlmRequest({url: `${normalizedUrl}${endpoint}`,@@ -312,7 +314,11 @@ const createNtlmClient = (post: async (endpoint: string, body: string, additionalHeaders: Record<string, string> = {}) => {const shouldRejectUnauthorized = sslRejectUnauthorized;- const httpsAgent = createHttpsAgent(shouldRejectUnauthorized, sslCertificate);+ const httpsAgent = await createHttpsAgent(+ `${normalizedUrl}${endpoint}`,+ shouldRejectUnauthorized,+ sslCertificate+ );return axiosNtlmRequest({url: `${normalizedUrl}${endpoint}`,diff --git a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.tsindex 4f8a91baeb..07651fdb38 100644--- a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts+++ b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts@@ -13,7 +13,7 @@ import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";import { logger } from "@app/lib/logger";import { getTlsServerNameOptions } from "@app/lib/tls";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import {decryptAppConnectionCredentials,encryptAppConnectionCredentials,@@ -66,7 +66,7 @@ export const requestWithAzureKeyVaultGateway = async <T>(// If gateway isn't set up, don't proxy the requestif (!gatewayId) {- return request.request({ ...requestConfig, ...ipGuardedAgents });+ return safeRequest.request({ ...requestConfig, url: requestConfig.url as string });}const [targetHost] = await verifyHostInputValidity({ host: url.hostname, isGateway: true, isDynamicSecret: false });diff --git a/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts b/backend/src/services/app-connection/netscaler/netscaler-connection-fns.tsindex e1df435aeb..2880184046 100644--- a/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts+++ b/backend/src/services/app-connection/netscaler/netscaler-connection-fns.ts@@ -8,22 +8,16 @@ import { getMissingGatewayMessage } from "@app/lib/gateway-v2/gateway-errors";import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";import { getTlsServerNameOptions } from "@app/lib/tls";-import { blockLocalAndPrivateIpAddresses, ipGuardedLookup } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { NetScalerConnectionMethod } from "./netscaler-connection-enums";import { TNetScalerConnectionConfig } from "./netscaler-connection-types";-export const createNetScalerHttpsAgent = (credentials: {- sslRejectUnauthorized?: boolean;- sslCertificate?: string;-}): https.Agent => {- return new https.Agent({- rejectUnauthorized: credentials.sslRejectUnauthorized,- ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined,- lookup: ipGuardedLookup- });-};+const getNetScalerTlsOptions = (credentials: { sslRejectUnauthorized?: boolean; sslCertificate?: string }) => ({+ rejectUnauthorized: credentials.sslRejectUnauthorized,+ ca: credentials.sslCertificate ? [credentials.sslCertificate] : undefined+});export const getNetScalerConnectionListItem = () => {return {@@ -86,10 +80,10 @@ const requestWithNetScalerGateway = async <T>(await blockLocalAndPrivateIpAddresses(`https://${hostname}`, false);- const httpsAgent = createNetScalerHttpsAgent(credentials);- const resp = await request.request<T>({+ const resp = await safeRequest.request<T>({...requestConfig,- httpsAgent+ url: requestConfig.url as string,+ ...getNetScalerTlsOptions(credentials)});return resp.data;};@@ -213,12 +207,11 @@ export const executeNetScalerOperationWithGateway = async <T>(await blockLocalAndPrivateIpAddresses(`https://${hostname}`, false);- const httpsAgent = createNetScalerHttpsAgent(credentials);-const makeRequest = async <R>(requestCfg: AxiosRequestConfig): Promise<R> => {- const resp = await request.request<R>({+ const resp = await safeRequest.request<R>({...requestCfg,- httpsAgent+ url: requestCfg.url as string,+ ...getNetScalerTlsOptions(credentials)});return resp.data;};diff --git a/backend/src/services/app-connection/trigger-dev/trigger-dev-connection-fns.ts b/backend/src/services/app-connection/trigger-dev/trigger-dev-connection-fns.tsindex dc10b9e8d3..91d9f91ae0 100644--- a/backend/src/services/app-connection/trigger-dev/trigger-dev-connection-fns.ts+++ b/backend/src/services/app-connection/trigger-dev/trigger-dev-connection-fns.ts@@ -1,9 +1,8 @@import { AxiosError } from "axios";-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { removeTrailingSlash } from "@app/lib/fn";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { IntegrationUrls } from "@app/services/integration-auth/integration-list";@@ -58,8 +57,7 @@ export const validateTriggerDevConnectionCredentials = async (config: TTriggerDeconst { apiKey } = config.credentials;try {- await request.get(`${instanceUrl}/api/v1/projects`, {- ...ipGuardedAgents,+ await safeRequest.get(`${instanceUrl}/api/v1/projects`, {headers: {Authorization: `Bearer ${apiKey}`,Accept: "application/json"@@ -83,8 +81,7 @@ export const listTriggerDevProjects = async (appConnection: TTriggerDevConnectioconst instanceUrl = await getTriggerDevInstanceUrl(appConnection);const { apiKey } = appConnection.credentials;- const { data } = await request.get<TTriggerDevApiProject[]>(`${instanceUrl}/api/v1/projects`, {- ...ipGuardedAgents,+ const { data } = await safeRequest.get<TTriggerDevApiProject[]>(`${instanceUrl}/api/v1/projects`, {headers: {Authorization: `Bearer ${apiKey}`,Accept: "application/json"@@ -114,10 +111,9 @@ export const listTriggerDevEnvironments = async (// Returns only the parent environments the token can access (dev is scoped to the// token owner); preview branch children are excluded since syncs target the parent.- const { data } = await request.get<TTriggerDevApiEnvironment[]>(+ const { data } = await safeRequest.get<TTriggerDevApiEnvironment[]>(`${instanceUrl}/api/v1/projects/${encodeURIComponent(projectRef)}/environments`,{- ...ipGuardedAgents,headers: {Authorization: `Bearer ${apiKey}`,Accept: "application/json"diff --git a/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts b/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.tsindex b21b59959d..7dbd9d4308 100644--- a/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts+++ b/backend/src/services/app-connection/venafi-tpp/venafi-tpp-connection-fns.ts@@ -10,7 +10,7 @@ import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";import { GatewayProxyProtocol } from "@app/lib/gateway-v2/types";import { logger } from "@app/lib/logger";import { getTlsServerNameOptions } from "@app/lib/tls";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { VenafiTppConnectionMethod } from "./venafi-tpp-connection-enums";@@ -55,7 +55,7 @@ export const requestWithVenafiTppGateway = async <T>(await blockLocalAndPrivateIpAddresses(url.toString(), Boolean(gatewayId));if (!gatewayId) {- return request.request({ ...requestConfig, ...ipGuardedAgents });+ return safeRequest.request({ ...requestConfig, url: requestConfig.url as string });}const [targetHost] = await verifyHostInputValidity({ host: url.hostname, isGateway: true, isDynamicSecret: false });diff --git a/backend/src/services/app-connection/zabbix/zabbix-connection-fns.ts b/backend/src/services/app-connection/zabbix/zabbix-connection-fns.tsindex 4e6f2ae410..9680f651e5 100644--- a/backend/src/services/app-connection/zabbix/zabbix-connection-fns.ts+++ b/backend/src/services/app-connection/zabbix/zabbix-connection-fns.ts@@ -1,9 +1,8 @@import { AxiosError } from "axios";import RE2 from "re2";-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { ZabbixConnectionMethod } from "./zabbix-connection-enums";@@ -40,13 +39,16 @@ export const validateZabbixConnectionCredentials = async (config: TZabbixConnectid: 1};- const response: { data: { error?: { message: string }; result?: string } } = await request.post(apiUrl, payload, {- ...ipGuardedAgents,- headers: {- "Content-Type": "application/json",- Authorization: `Bearer ${apiToken}`+ const response: { data: { error?: { message: string }; result?: string } } = await safeRequest.post(+ apiUrl,+ payload,+ {+ headers: {+ "Content-Type": "application/json",+ Authorization: `Bearer ${apiToken}`+ }}- });+ );if (response.data.error) {throw new BadRequestError({@@ -83,8 +85,7 @@ export const listZabbixHosts = async (appConnection: TZabbixConnection): Promiseid: 1};- const response: { data: TZabbixHostListResponse } = await request.post(apiUrl, payload, {- ...ipGuardedAgents,+ const response: { data: TZabbixHostListResponse } = await safeRequest.post(apiUrl, payload, {headers: {"Content-Type": "application/json",Authorization: `Bearer ${apiToken}`diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.tsindex 7464e0b90d..35d6fe7492 100644--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts@@ -17,7 +17,7 @@ import { isPrivateIp } from "@app/lib/ip/ipRange";import { ProcessedPermissionRules } from "@app/lib/knex/permission-filter-utils";import { logger } from "@app/lib/logger";import { OrgServiceActor } from "@app/lib/types";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, buildSsrfSafeAgent } from "@app/lib/validator";import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { decryptAppConnection } from "@app/services/app-connection/app-connection-fns";@@ -462,9 +462,16 @@ export const executeAcmeOrder = async (await reportProgress("Submitting order to the certificate authority");- const ipGuardInterceptorId = acme.axios.interceptors.request.use(async (config) => {- if (config.url) await blockLocalAndPrivateIpAddresses(config.url);- return { ...config, ...ipGuardedAgents, maxRedirects: 0 };+ const ssrfInterceptorId = acme.axios.interceptors.request.use(async (config) => {+ if (!config.url) return config;+ const agent = await buildSsrfSafeAgent(config.url);+ return {+ ...config,+ httpAgent: agent,+ httpsAgent: agent,+ maxRedirects: 0,+ ...(getConfig().SAFE_REQUEST_FORCE_DIRECT_EGRESS && { proxy: false as const })+ };});const order = acmeClient.auto({@@ -634,7 +641,7 @@ export const executeAcmeOrder = async (}});- const pem = await order.finally(() => acme.axios.interceptors.request.eject(ipGuardInterceptorId));+ const pem = await order.finally(() => acme.axios.interceptors.request.eject(ssrfInterceptorId));if (isCancelled && (await isCancelled())) {throw new CertificateRequestCancelledError();diff --git a/backend/src/services/secret-sync/1password/1password-sync-fns.ts b/backend/src/services/secret-sync/1password/1password-sync-fns.tsindex 4fb8972185..86d282f3d7 100644--- a/backend/src/services/secret-sync/1password/1password-sync-fns.ts+++ b/backend/src/services/secret-sync/1password/1password-sync-fns.ts@@ -1,5 +1,4 @@-import { request } from "@app/lib/config/request";-import { ipGuardedAgents } from "@app/lib/validator";+import { safeRequest } from "@app/lib/validator";import { getOnePassInstanceUrl } from "@app/services/app-connection/1password";import {TDeleteOnePassVariable,@@ -18,8 +17,7 @@ import { TSecretSyncPayload } from "@app/services/secret-sync/secret-sync-payloaconst VALUE_LABEL_DEFAULT = "value";const listOnePassItems = async ({ instanceUrl, apiToken, vaultId, valueLabel }: TOnePassListVariables) => {- const { data } = await request.get<TOnePassListVariablesResponse>(`${instanceUrl}/v1/vaults/${vaultId}/items`, {- ...ipGuardedAgents,+ const { data } = await safeRequest.get<TOnePassListVariablesResponse>(`${instanceUrl}/v1/vaults/${vaultId}/items`, {headers: {Authorization: `Bearer ${apiToken}`,Accept: "application/json"@@ -39,13 +37,15 @@ const listOnePassItems = async ({ instanceUrl, apiToken, vaultId, valueLabel }:continue;}- const { data: secret } = await request.get<TOnePassVariable>(`${instanceUrl}/v1/vaults/${vaultId}/items/${s.id}`, {- ...ipGuardedAgents,- headers: {- Authorization: `Bearer ${apiToken}`,- Accept: "application/json"+ const { data: secret } = await safeRequest.get<TOnePassVariable>(+ `${instanceUrl}/v1/vaults/${vaultId}/items/${s.id}`,+ {+ headers: {+ Authorization: `Bearer ${apiToken}`,+ Accept: "application/json"+ }}- });+ );const valueField = secret.fields.find((f) => f.label === valueLabel);@@ -70,7 +70,7 @@ const createOnePassItem = async ({itemValue,valueLabel}: TPostOnePassVariable) => {- return request.post(+ return safeRequest.post(`${instanceUrl}/v1/vaults/${vaultId}/items`,{title: itemTitle,@@ -88,7 +88,6 @@ const createOnePassItem = async ({]},{- ...ipGuardedAgents,headers: {Authorization: `Bearer ${apiToken}`,"Content-Type": "application/json"@@ -108,7 +107,7 @@ const updateOnePassItem = async ({valueLabel,otherFields}: TPutOnePassVariable) => {- return request.put(+ return safeRequest.put(`${instanceUrl}/v1/vaults/${vaultId}/items/${itemId}`,{id: itemId,@@ -129,7 +128,6 @@ const updateOnePassItem = async ({]},{- ...ipGuardedAgents,headers: {Authorization: `Bearer ${apiToken}`,"Content-Type": "application/json"@@ -139,8 +137,7 @@ const updateOnePassItem = async ({};const deleteOnePassItem = async ({ instanceUrl, apiToken, vaultId, itemId }: TDeleteOnePassVariable) => {- return request.delete(`${instanceUrl}/v1/vaults/${vaultId}/items/${itemId}`, {- ...ipGuardedAgents,+ return safeRequest.delete(`${instanceUrl}/v1/vaults/${vaultId}/items/${itemId}`, {headers: {Authorization: `Bearer ${apiToken}`}diff --git a/backend/src/services/secret-sync/trigger-dev/trigger-dev-sync-fns.ts b/backend/src/services/secret-sync/trigger-dev/trigger-dev-sync-fns.tsindex 0d18e36a68..8499303a92 100644--- a/backend/src/services/secret-sync/trigger-dev/trigger-dev-sync-fns.ts+++ b/backend/src/services/secret-sync/trigger-dev/trigger-dev-sync-fns.ts@@ -1,5 +1,4 @@-import { request } from "@app/lib/config/request";-import { ipGuardedAgents } from "@app/lib/validator";+import { safeRequest } from "@app/lib/validator";import { getTriggerDevInstanceUrl } from "@app/services/app-connection/trigger-dev";import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";@@ -37,8 +36,7 @@ const listTriggerDevEnvVars = async (const { apiKey } = secretSync.connection.credentials;try {- const { data } = await request.get<TTriggerDevEnvVar[]>(baseUrl, {- ...ipGuardedAgents,+ const { data } = await safeRequest.get<TTriggerDevEnvVar[]>(baseUrl, {headers: {Authorization: `Bearer ${apiKey}`,Accept: "application/json"@@ -66,11 +64,10 @@ const importTriggerDevEnvVars = async (const isSecret = secretSync.syncOptions.markAsSecret ?? true;try {- await request.post(+ await safeRequest.post(`${baseUrl}/import`,{ variables, override: true, isSecret },{- ...ipGuardedAgents,headers: {Authorization: `Bearer ${apiKey}`,"Content-Type": "application/json"@@ -96,8 +93,7 @@ const deleteTriggerDevEnvVar = async (const { apiKey } = secretSync.connection.credentials;try {- await request.delete(`${baseUrl}/${encodeURIComponent(key)}`, {- ...ipGuardedAgents,+ await safeRequest.delete(`${baseUrl}/${encodeURIComponent(key)}`, {headers: {Authorization: `Bearer ${apiKey}`,Accept: "application/json"diff --git a/backend/src/services/secret-sync/zabbix/zabbix-sync-fns.ts b/backend/src/services/secret-sync/zabbix/zabbix-sync-fns.tsindex bb0950f3c5..5c518f8d46 100644--- a/backend/src/services/secret-sync/zabbix/zabbix-sync-fns.ts+++ b/backend/src/services/secret-sync/zabbix/zabbix-sync-fns.ts@@ -1,7 +1,6 @@import RE2 from "re2";-import { request } from "@app/lib/config/request";-import { blockLocalAndPrivateIpAddresses, ipGuardedAgents } from "@app/lib/validator";+import { blockLocalAndPrivateIpAddresses, safeRequest } from "@app/lib/validator";import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";import { TSecretSyncPayload } from "@app/services/secret-sync/secret-sync-payload";@@ -58,8 +57,7 @@ const listZabbixSecrets = async (apiToken: string, instanceUrl: string, hostId?:};try {- const response: ZabbixApiResponse<TZabbixSecret[]> = await request.post(apiUrl, payload, {- ...ipGuardedAgents,+ const response: ZabbixApiResponse<TZabbixSecret[]> = await safeRequest.post(apiUrl, payload, {headers: {"Content-Type": "application/json",Authorization: `Bearer ${apiToken}`@@ -106,8 +104,7 @@ const putZabbixSecrets = async (};// eslint-disable-next-line no-await-in-loop- const response: ZabbixApiResponse<ZabbixMacroCreateResponse> = await request.post(apiUrl, updatePayload, {- ...ipGuardedAgents,+ const response: ZabbixApiResponse<ZabbixMacroCreateResponse> = await safeRequest.post(apiUrl, updatePayload, {headers: {"Content-Type": "application/json",Authorization: `Bearer ${apiToken}`@@ -138,8 +135,7 @@ const putZabbixSecrets = async (};// eslint-disable-next-line no-await-in-loop- const response: ZabbixApiResponse<ZabbixMacroCreateResponse> = await request.post(apiUrl, createPayload, {- ...ipGuardedAgents,+ const response: ZabbixApiResponse<ZabbixMacroCreateResponse> = await safeRequest.post(apiUrl, createPayload, {headers: {"Content-Type": "application/json",Authorization: `Bearer ${apiToken}`@@ -183,8 +179,7 @@ const deleteZabbixSecrets = async (id: 1};- const response: ZabbixApiResponse<ZabbixMacroDeleteResponse> = await request.post(apiUrl, payload, {- ...ipGuardedAgents,+ const response: ZabbixApiResponse<ZabbixMacroDeleteResponse> = await safeRequest.post(apiUrl, payload, {headers: {"Content-Type": "application/json",Authorization: `Bearer ${apiToken}`