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
chore: move request to use safeRequest
adilson847c655ec8a2
diff --git a/backend/src/ee/services/secret-rotation-v2/cloudflare-api-token/cloudflare-api-token-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/cloudflare-api-token/cloudflare-api-token-rotation-fns.tsindex 960dd4693e..c654e4972e 100644--- a/backend/src/ee/services/secret-rotation-v2/cloudflare-api-token/cloudflare-api-token-rotation-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/cloudflare-api-token/cloudflare-api-token-rotation-fns.ts@@ -8,9 +8,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 { logger } from "@app/lib/logger";+import { safeRequest } from "@app/lib/validator";import {getCloudflareAuthHeaders,getCloudflareErrorMessage@@ -84,7 +84,7 @@ export const cloudflareApiTokenRotationFactory: TRotationFactory<const $createToken = async () => {try {- const { data } = await request.post<TCloudflareCreateTokenResponse>(+ const { data } = await safeRequest.post<TCloudflareCreateTokenResponse>(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}/tokens`,{name: `${name}-${Date.now()}`,@@ -122,7 +122,7 @@ export const cloudflareApiTokenRotationFactory: TRotationFactory<const $deleteToken = async (tokenId: string) => {try {- await request.delete(+ await safeRequest.delete(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}/tokens/${encodeURIComponent(tokenId)}`,{ headers: authHeaders });@@ -201,7 +201,7 @@ export const cloudflareApiTokenRotationFactory: TRotationFactory<TCloudflareApiTokenRotationGeneratedCredentials> = async (activeCredentials) => {try {- const { data } = await request.get<TCloudflareVerifyTokenResponse>(+ const { data } = await safeRequest.get<TCloudflareVerifyTokenResponse>(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}/tokens/verify`,{ headers: getCloudflareAuthHeaders(activeCredentials.apiToken) });diff --git a/backend/src/services/app-connection/cloudflare/cloudflare-connection-fns.ts b/backend/src/services/app-connection/cloudflare/cloudflare-connection-fns.tsindex 0098fa695b..0c2664d4b2 100644--- a/backend/src/services/app-connection/cloudflare/cloudflare-connection-fns.ts+++ b/backend/src/services/app-connection/cloudflare/cloudflare-connection-fns.ts@@ -1,7 +1,7 @@import { AxiosError } from "axios";-import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";+import { safeRequest } from "@app/lib/validator";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import { IntegrationUrls } from "@app/services/integration-auth/integration-list";@@ -45,7 +45,7 @@ const $paginateCloudflare = async <T>(while (page <= totalPages && page <= CLOUDFLARE_MAX_PAGES) {// eslint-disable-next-line no-await-in-loop- const { data } = await request.get<{ result: T[]; result_info?: { total_pages?: number } }>(url, {+ const { data } = await safeRequest.get<{ result: T[]; result_info?: { total_pages?: number } }>(url, {headers: getCloudflareAuthHeaders(apiToken),params: { ...params, page, per_page: CLOUDFLARE_PER_PAGE }});@@ -74,7 +74,7 @@ export const listCloudflarePagesProjects = async (credentials: { apiToken, accountId }} = appConnection;- const { data } = await request.get<{ result: { name: string; id: string }[] }>(+ const { data } = await safeRequest.get<{ result: { name: string; id: string }[] }>(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}/pages/projects`,{ headers: getCloudflareAuthHeaders(apiToken) });@@ -92,7 +92,7 @@ export const listCloudflareWorkersScripts = async (credentials: { apiToken, accountId }} = appConnection;- const { data } = await request.get<{ result: { id: string }[] }>(+ const { data } = await safeRequest.get<{ result: { id: string }[] }>(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}/workers/scripts`,{ headers: getCloudflareAuthHeaders(apiToken) });@@ -134,7 +134,7 @@ export const listCloudflarePermissionGroups = async (for (let page = 1; page <= CLOUDFLARE_MAX_PAGES; page += 1) {// eslint-disable-next-line no-await-in-loop- const { data } = await request.get<{ result: { id: string; name: string; scopes?: string[] }[] }>(+ const { data } = await safeRequest.get<{ result: { id: string; name: string; scopes?: string[] }[] }>(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}/tokens/permission_groups`,{headers: getCloudflareAuthHeaders(apiToken),@@ -160,7 +160,7 @@ export const validateCloudflareConnectionCredentials = async (config: TCloudflarconst { apiToken, accountId } = config.credentials;try {- const resp = await request.get(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}`, {+ const resp = await safeRequest.get(`${IntegrationUrls.CLOUDFLARE_API_URL}/client/v4/accounts/${accountId}`, {headers: getCloudflareAuthHeaders(apiToken)});