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
feat: updated more checks
=e7a08d81587d
diff --git a/backend/src/ee/routes/v1/ai-mcp-endpoint-router.ts b/backend/src/ee/routes/v1/ai-mcp-endpoint-router.tsindex c1e2a74c81..7fb452f1eb 100644--- a/backend/src/ee/routes/v1/ai-mcp-endpoint-router.ts+++ b/backend/src/ee/routes/v1/ai-mcp-endpoint-router.ts@@ -603,7 +603,15 @@ export const registerAiMcpEndpointRouter = async (server: FastifyZodProvider) =>response: {200: z.object({client_id: z.string(),- redirect_uris: z.array(z.string()),+ redirect_uris: z.array(+ z+ .string()+ .url()+ .refine(+ (uri) => uri.startsWith("https://") || uri.startsWith("http://"),+ "Redirect URI must start with https:// or http://"+ )+ ),client_name: z.string(),client_uri: z.string().optional(),grant_types: z.array(z.string()),@@ -687,7 +695,13 @@ export const registerAiMcpEndpointRouter = async (server: FastifyZodProvider) =>client_id: z.string(),code_challenge: z.string(),code_challenge_method: z.enum(["S256"]),- redirect_uri: z.string(),+ redirect_uri: z+ .string()+ .url()+ .refine(+ (uri) => uri.startsWith("https://") || uri.startsWith("http://"),+ "Redirect URI must start with https:// or http://"+ ),resource: z.string().optional(),expireIn: z.string().refine((val) => ms(val) > 0, "Max TTL must be a positive number")}),diff --git a/backend/src/ee/routes/v1/secret-approval-request-router.ts b/backend/src/ee/routes/v1/secret-approval-request-router.tsindex 1822e53ed2..19a26d6d6e 100644--- a/backend/src/ee/routes/v1/secret-approval-request-router.ts+++ b/backend/src/ee/routes/v1/secret-approval-request-router.ts@@ -133,7 +133,7 @@ export const registerSecretApprovalRequestRouter = async (server: FastifyZodProvid: z.string()}),body: z.object({- bypassReason: z.string().optional()+ bypassReason: z.string().max(1000).optional()}),response: {200: z.object({diff --git a/backend/src/ee/services/ai-mcp-server/ai-mcp-server-service.ts b/backend/src/ee/services/ai-mcp-server/ai-mcp-server-service.tsindex 570b99acf7..5f4fa84285 100644--- a/backend/src/ee/services/ai-mcp-server/ai-mcp-server-service.ts+++ b/backend/src/ee/services/ai-mcp-server/ai-mcp-server-service.ts@@ -86,12 +86,12 @@ const refreshOAuthToken = async (try {// First try: origin-only formatconst originOnlyUrl = `${serverUrlObj.origin}/.well-known/oauth-authorization-server`;- const { data } = await request.get<TOAuthAuthorizationServerMetadata>(originOnlyUrl);+ const { data } = await ssrfSafeGet<TOAuthAuthorizationServerMetadata>(originOnlyUrl);serverMetadata = data;} catch {// Second try: origin + pathname formatconst pathnameUrl = `${serverUrlObj.origin}/.well-known/oauth-authorization-server${serverUrlObj.pathname !== "/" ? serverUrlObj.pathname : ""}`;- const { data } = await request.get<TOAuthAuthorizationServerMetadata>(pathnameUrl);+ const { data } = await ssrfSafeGet<TOAuthAuthorizationServerMetadata>(pathnameUrl);serverMetadata = data;}@@ -106,7 +106,7 @@ const refreshOAuthToken = async (tokenParams.client_secret = clientSecret;}- const { data: tokenResponse } = await request.post<TOAuthTokenResponse>(+ const { data: tokenResponse } = await ssrfSafePost<TOAuthTokenResponse>(serverMetadata.token_endpoint,new URLSearchParams(tokenParams).toString(),{diff --git a/backend/src/ee/services/ldap-config/ldap-config-service.ts b/backend/src/ee/services/ldap-config/ldap-config-service.tsindex 7a21480f44..1d1e3f0eae 100644--- a/backend/src/ee/services/ldap-config/ldap-config-service.ts+++ b/backend/src/ee/services/ldap-config/ldap-config-service.ts@@ -415,7 +415,6 @@ export const ldapConfigServiceFactory = ({});}- // Verify that the email domain (if verified on the platform) belongs to this orgawait verifyEmailDomainOwnership({ email, orgId, emailDomainDAL });const sanitizedEmail = sanitizeEmail(email);validateEmail(sanitizedEmail);diff --git a/backend/src/ee/services/oidc/oidc-config-service.ts b/backend/src/ee/services/oidc/oidc-config-service.tsindex 65cc514796..78c6f85bc4 100644--- a/backend/src/ee/services/oidc/oidc-config-service.ts+++ b/backend/src/ee/services/oidc/oidc-config-service.ts@@ -197,7 +197,6 @@ export const oidcConfigServiceFactory = ({});}- // Verify that the email domain (if verified on the platform) belongs to this orgawait verifyEmailDomainOwnership({ email, orgId, emailDomainDAL });const sanitizedEmail = sanitizeEmail(email);validateEmail(sanitizedEmail);diff --git a/backend/src/ee/services/saml-config/saml-config-service.ts b/backend/src/ee/services/saml-config/saml-config-service.tsindex f6b24789c0..63e6377fcd 100644--- a/backend/src/ee/services/saml-config/saml-config-service.ts+++ b/backend/src/ee/services/saml-config/saml-config-service.ts@@ -532,7 +532,6 @@ export const samlConfigServiceFactory = ({aliasType: UserAliasType.SAML});- // Verify that the email domain (if verified on the platform) belongs to this orgawait verifyEmailDomainOwnership({ email, orgId, emailDomainDAL });const sanitizedEmail = sanitizeEmail(email);validateEmail(sanitizedEmail);diff --git a/backend/src/ee/services/scim/scim-service.ts b/backend/src/ee/services/scim/scim-service.tsindex 86fd94bdd9..a6cb418885 100644--- a/backend/src/ee/services/scim/scim-service.ts+++ b/backend/src/ee/services/scim/scim-service.ts@@ -424,8 +424,6 @@ export const scimServiceFactory = ({aliasType});- // Verify that the email domain (if verified on the platform) belongs to this org-await verifyEmailDomainOwnership({ email, orgId, emailDomainDAL });const { user: createdUser, orgMembership: createdOrgMembership } = await userDAL.transaction(async (tx) => {diff --git a/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.ts b/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.tsindex 258fb8ac0e..0a2d52e410 100644--- a/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.ts+++ b/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.ts@@ -70,7 +70,14 @@ export const bitbucketSecretScanningService = (hmac.update(bodyString);const calculatedSignature = hmac.digest("hex");- if (calculatedSignature !== receivedSignature) {+ const isValid =+ calculatedSignature.length === receivedSignature.length &&+ crypto.nativeCrypto.timingSafeEqual(+ Buffer.from(calculatedSignature, "hex"),+ Buffer.from(receivedSignature, "hex")+ );++ if (!isValid) {logger.error(`secretScanningV2PushEvent: Bitbucket - Invalid signature for webhook [dataSourceId=${dataSource.id}] [workspaceUuid=${repository.workspace.uuid}]`);diff --git a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-factory.ts b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-factory.tsindex a18359073b..ef40ab795a 100644--- a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-factory.ts+++ b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-factory.ts@@ -42,18 +42,6 @@ import {TQueueGitLabResourceDiffScan} from "./gitlab-secret-scanning-types";-const getMainDomain = (instanceUrl: string) => {- const url = new URL(instanceUrl);- const { hostname } = url;- const parts = hostname.split(".");-- if (parts.length >= 2) {- return parts.slice(-2).join(".");- }-- return hostname;-};-export const GitLabSecretScanningFactory = ({ appConnectionDAL, kmsService }: TSecretScanningFactoryParams) => {const initialize: TSecretScanningFactoryInitialize<TGitLabDataSourceInput,@@ -272,8 +260,10 @@ export const GitLabSecretScanningFactory = ({ appConnectionDAL, kmsService }: TSthrow new Error("Invalid GitLab project name");}+ const validatedHostname = new URL(instanceUrl).hostname;+await cloneRepository({- cloneUrl: `https://${user.username}:${connection.credentials.accessToken}@${getMainDomain(instanceUrl)}/${resourceName}.git`,+ cloneUrl: `https://${user.username}:${connection.credentials.accessToken}@${validatedHostname}/${resourceName}.git`,repoPath});diff --git a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.ts b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.tsindex bc669a2f5b..1d7d13850c 100644--- a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.ts+++ b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.ts@@ -2,6 +2,7 @@ import { GitLabDataSourceScope } from "@app/ee/services/secret-scanning-v2/gitlaimport { TSecretScanningV2DALFactory } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-dal";import { SecretScanningDataSource } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-enums";import { TSecretScanningV2QueueServiceFactory } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-queue";+import { crypto } from "@app/lib/crypto";import { logger } from "@app/lib/logger";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsDataKey } from "@app/services/kms/kms-types";@@ -57,7 +58,13 @@ export const gitlabSecretScanningService = (const credentials = JSON.parse(decryptedCredentials.toString()) as TGitLabDataSourceCredentials;- if (token !== credentials.token) {+ const storedToken = Buffer.from(credentials.token, "utf8");+ const receivedToken = Buffer.from(token, "utf8");++ const isValid =+ storedToken.length === receivedToken.length && crypto.nativeCrypto.timingSafeEqual(storedToken, receivedToken);++ if (!isValid) {logger.error(`secretScanningV2PushEvent: GitLab - Invalid webhook token [dataSourceId=${dataSource.id}] [projectId=${payload.project.id}]`);diff --git a/backend/src/server/routes/v1/integration-router.ts b/backend/src/server/routes/v1/integration-router.tsindex 8654c215a5..f5cfa11994 100644--- a/backend/src/server/routes/v1/integration-router.ts+++ b/backend/src/server/routes/v1/integration-router.ts@@ -53,7 +53,7 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {targetService: z.string().trim().optional().describe(INTEGRATION.CREATE.targetService),targetServiceId: z.string().trim().optional().describe(INTEGRATION.CREATE.targetServiceId),owner: z.string().trim().optional().describe(INTEGRATION.CREATE.owner),- url: z.string().trim().optional().describe(INTEGRATION.CREATE.url),+ url: z.string().url().trim().optional().describe(INTEGRATION.CREATE.url),path: z.string().trim().optional().describe(INTEGRATION.CREATE.path),region: z.string().trim().optional().describe(INTEGRATION.CREATE.region),scope: z.string().trim().optional().describe(INTEGRATION.CREATE.scope),diff --git a/backend/src/server/routes/v1/microsoft-teams-router.ts b/backend/src/server/routes/v1/microsoft-teams-router.tsindex d0905c23bc..9928ae82ce 100644--- a/backend/src/server/routes/v1/microsoft-teams-router.ts+++ b/backend/src/server/routes/v1/microsoft-teams-router.ts@@ -376,6 +376,9 @@ export const registerMicrosoftTeamsRouter = async (server: FastifyZodProvider) =server.route({method: "POST",url: "/message-endpoint",+ config: {+ rateLimit: writeLimit+ },schema: {operationId: "handleMicrosoftTeamsMessageEndpoint",body: z.any(),diff --git a/backend/src/server/routes/v1/webhook-router.ts b/backend/src/server/routes/v1/webhook-router.tsindex 3345aaaaec..3a45c42531 100644--- a/backend/src/server/routes/v1/webhook-router.ts+++ b/backend/src/server/routes/v1/webhook-router.ts@@ -68,12 +68,15 @@ export const registerWebhookRouter = async (server: FastifyZodProvider) => {.optional()}).superRefine((data, ctx) => {- if (data.type === WebhookType.SLACK && !data.webhookUrl.includes("hooks.slack.com")) {- ctx.addIssue({- code: z.ZodIssueCode.custom,- message: "Incoming Webhook URL is invalid.",- path: ["webhookUrl"]- });+ if (data.type === WebhookType.SLACK) {+ const parsed = new URL(data.webhookUrl);+ if (parsed.hostname !== "hooks.slack.com") {+ ctx.addIssue({+ code: z.ZodIssueCode.custom,+ message: "Incoming Webhook URL is invalid.",+ path: ["webhookUrl"]+ });+ }}}),response: {diff --git a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.tsindex ca0833e40b..37eeeaeb15 100644--- a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts+++ b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts@@ -69,9 +69,19 @@ export const refreshGitLabToken = async (kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">,instanceUrl?: string): Promise<string> => {- const { INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID, INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET, SITE_URL } =- getConfig();- if (!INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET || !INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID || !SITE_URL) {+ const {+ INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID,+ INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET,+ SITE_URL,+ isCloud+ } = getConfig();+ if (+ !INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET ||+ !INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID ||+ !SITE_URL ||+ // Cloud instances do not support OAuth authentication+ isCloud+ ) {throw new InternalServerError({message: `GitLab environment variables have not been configured`});@@ -128,9 +138,18 @@ export const exchangeGitLabOAuthCode = async (code: string,instanceUrl?: string): Promise<GitLabOAuthTokenResponse> => {- const { INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID, INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET, SITE_URL } =- getConfig();- if (!INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET || !INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID || !SITE_URL) {+ const {+ INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID,+ INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET,+ SITE_URL,+ isCloud+ } = getConfig();+ if (+ !INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_SECRET ||+ !INF_APP_CONNECTION_GITLAB_OAUTH_CLIENT_ID ||+ !SITE_URL ||+ isCloud+ ) {throw new InternalServerError({message: `GitLab environment variables have not been configured`});diff --git a/backend/src/services/external-migration/external-migration-fns/vault.ts b/backend/src/services/external-migration/external-migration-fns/vault.tsindex 97171bf261..aee421111b 100644--- a/backend/src/services/external-migration/external-migration-fns/vault.ts+++ b/backend/src/services/external-migration/external-migration-fns/vault.ts@@ -217,6 +217,7 @@ const vaultFactory = (gatewayService: Pick<TGatewayServiceFactory, "fnGetGateway"X-Vault-Token": accessToken,...(namespace ? { "X-Vault-Namespace": namespace } : {})},+ maxRedirects: 0,httpsAgent});diff --git a/backend/src/services/integration-auth/integration-sync-secret.ts b/backend/src/services/integration-auth/integration-sync-secret.tsindex b031b6c3c9..7543b2b1a4 100644--- a/backend/src/services/integration-auth/integration-sync-secret.ts+++ b/backend/src/services/integration-auth/integration-sync-secret.ts@@ -37,6 +37,7 @@ import { request } from "@app/lib/config/request";import { crypto } from "@app/lib/crypto/cryptography";import { BadRequestError, InternalServerError } from "@app/lib/errors";import { logger } from "@app/lib/logger";+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";import { TCreateManySecretsRawFn, TUpdateManySecretsRawFn } from "@app/services/secret/secret-types";import { TIntegrationDALFactory } from "../integration/integration-dal";@@ -315,6 +316,8 @@ const syncSecretsAzureAppConfig = async ({message: "Invalid Azure App Configuration URL provided."});+ await blockLocalAndPrivateIpAddresses(integration.app);+const getCompleteAzureAppConfigValues = async (baseURL: string, url: string) => {let result: AzureAppConfigKeyValue[] = [];while (url) {@@ -331,6 +334,9 @@ const syncSecretsAzureAppConfig = async ({result = result.concat(res.data.items);url = res.data?.["@nextLink"];+ if (url) {+ await blockLocalAndPrivateIpAddresses(url);+ }}return result;@@ -504,6 +510,12 @@ const syncSecretsAzureKeyVault = async ({createManySecretsRawFn: (params: TCreateManySecretsRawFn) => Promise<Array<{ id: string }>>;updateManySecretsRawFn: (params: TUpdateManySecretsRawFn) => Promise<Array<{ id: string }>>;}) => {+ if (!integration.app) {+ throw new BadRequestError({ message: "Azure Key Vault URI is required" });+ }++ await blockLocalAndPrivateIpAddresses(integration.app);+interface GetAzureKeyVaultSecret {id: string; // secret URIvalue: string;@@ -537,6 +549,9 @@ const syncSecretsAzureKeyVault = async ({result = result.concat(res.data.value);url = res.data.nextLink;+ if (url) {+ await blockLocalAndPrivateIpAddresses(url);+ }}return result;@@ -2561,6 +2576,7 @@ const syncSecretsDatabricks = async ({}) => {const databricksApiUrl = `${integrationAuth.url}/api`;+ await blockLocalAndPrivateIpAddresses(databricksApiUrl);// sync secrets to Databricksawait Promise.all(Object.keys(secrets).map(async (key) =>@@ -2750,6 +2766,7 @@ const syncSecretsAzureDevops = async ({return { groupId: "", groupName: "" };};+ await blockLocalAndPrivateIpAddresses(azureDevopsApiUrl);const { groupId, groupName } = await getEnvGroupId(integration.app, integration.appId, integration.environment.name);const variables: Record<string, { value: string; isSecret: boolean }> = {};@@ -2851,6 +2868,11 @@ const syncSecretsGitLab = async ({const gitLabApiUrl = integrationAuth.url ? `${integrationAuth.url}/api` : IntegrationUrls.GITLAB_API_URL;+ // Validate the base URL to prevent SSRF on all subsequent requests+ if (integrationAuth.url) {+ await blockLocalAndPrivateIpAddresses(gitLabApiUrl);+ }+const getAllEnvVariables = async (integrationAppId: string, accToken: string) => {const headers = {Authorization: `Bearer ${accToken}`,@@ -2862,6 +2884,7 @@ const syncSecretsGitLab = async ({let url: string | null = `${gitLabApiUrl}/v4/projects/${integrationAppId}/variables?per_page=100`;while (url) {+ await blockLocalAndPrivateIpAddresses(url);const response = await request.get(url, { headers });allEnvVariables = [...allEnvVariables, ...response.data];@@ -3562,6 +3585,9 @@ const syncSecretsTeamCity = async ({property: TeamCityBuildConfigParameter[];}+ if (integrationAuth.url) {+ await blockLocalAndPrivateIpAddresses(integrationAuth.url);+ }if (integration.targetEnvironment && integration.targetEnvironmentId) {// case: sync to specific build-config in TeamCity projectconst res = (@@ -3704,6 +3730,12 @@ const syncSecretsHashiCorpVault = async ({throw new Error("Access ID is required");}+ if (!integrationAuth.url) {+ throw new BadRequestError({ message: "HashiCorp Vault URL is required" });+ }++ await blockLocalAndPrivateIpAddresses(integrationAuth.url);+interface LoginAppRoleRes {auth: {client_token: string;@@ -3975,6 +4007,7 @@ const syncSecretsBitbucket = async ({}if (data.next) {+ await blockLocalAndPrivateIpAddresses(data.next);variablesUrl = data.next;} else {hasNextPage = false;@@ -4134,6 +4167,9 @@ const syncSecretsWindmill = async ({description?: string;}const apiUrl = integration.url ? `${integration.url}/api` : IntegrationUrls.WINDMILL_API_URL;+ if (apiUrl) {+ await blockLocalAndPrivateIpAddresses(apiUrl);+ }// get secrets stored in windmill workspaceconst res = (await request.get<WindmillSecret[]>(`${apiUrl}/w/${integration.appId}/variables/list`, {@@ -4458,7 +4494,11 @@ const syncSecretsRundeck = async ({}let existingRundeckSecrets: string[] = [];+ if (!integration.url) {+ return;+ }+ await blockLocalAndPrivateIpAddresses(integration.url);try {const listResult = await request.get<RundeckSecretsGetRes>(`${integration.url}/api/44/storage/${integration.path}`,@@ -4532,6 +4572,8 @@ const syncSecretsOctopusDeploy = async ({throw new InternalServerError({ message: `Unhandled Octopus Deploy scope: ${integration.scope}` });}+ await blockLocalAndPrivateIpAddresses(url);+// SDK doesn't support variable set...const { data: variableSet } = await request.get<TOctopusDeployVariableSet>(url, {headers: {diff --git a/backend/src/services/integration/integration-service.ts b/backend/src/services/integration/integration-service.tsindex 885450afe6..faa1cccf1f 100644--- a/backend/src/services/integration/integration-service.ts+++ b/backend/src/services/integration/integration-service.ts@@ -10,6 +10,7 @@ import {} from "@app/ee/services/permission/project-permission";import { NotFoundError } from "@app/lib/errors";import { TProjectPermission } from "@app/lib/types";+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";import { TIntegrationAuthDALFactory } from "../integration-auth/integration-auth-dal";import { TIntegrationAuthServiceFactory } from "../integration-auth/integration-auth-service";@@ -108,6 +109,10 @@ export const integrationServiceFactory = ({});}+ if (url) {+ await blockLocalAndPrivateIpAddresses(url);+ }+const integration = await integrationDAL.create({envId: folder.envId,secretPath,diff --git a/backend/src/services/pki-sync/azure-key-vault/azure-key-vault-pki-sync-fns.ts b/backend/src/services/pki-sync/azure-key-vault/azure-key-vault-pki-sync-fns.tsindex 390a08098c..6b14475481 100644--- a/backend/src/services/pki-sync/azure-key-vault/azure-key-vault-pki-sync-fns.ts+++ b/backend/src/services/pki-sync/azure-key-vault/azure-key-vault-pki-sync-fns.ts@@ -5,6 +5,7 @@ import * as crypto from "crypto";import { TCertificateSyncs } from "@app/db/schemas";import { request } from "@app/lib/config/request";import { logger } from "@app/lib/logger";+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";import { getAzureConnectionAccessToken } from "@app/services/app-connection/azure-key-vault/azure-key-vault-connection-fns";import { TCertificateDALFactory } from "@app/services/certificate/certificate-dal";@@ -211,6 +212,8 @@ export const azureKeyVaultPkiSyncFactory = ({certificateDAL}: TAzureKeyVaultPkiSyncFactoryDeps) => {const $getAzureKeyVaultCertificates = async (accessToken: string, vaultBaseUrl: string, syncId = "unknown") => {+ await blockLocalAndPrivateIpAddresses(vaultBaseUrl);+const paginateAzureKeyVaultCertificates = async () => {let result: GetAzureKeyVaultCertificate[] = [];@@ -218,6 +221,7 @@ export const azureKeyVaultPkiSyncFactory = ({while (currentUrl) {const urlToFetch = currentUrl; // Capture current URL to avoid loop function issue+ await blockLocalAndPrivateIpAddresses(urlToFetch);const res = await withRateLimitRetry(() =>request.get<{ value: GetAzureKeyVaultCertificate[]; nextLink: string }>(urlToFetch, {@@ -248,14 +252,13 @@ export const azureKeyVaultPkiSyncFactory = ({const certificateResults = await executeWithConcurrencyLimit(enabledAzureKeyVaultCertificates,async (getAzureKeyVaultCertificate) => {- const azureKeyVaultCertificate = await request.get<GetAzureKeyVaultCertificate>(- `${getAzureKeyVaultCertificate.id}?api-version=7.4`,- {- headers: {- Authorization: `Bearer ${accessToken}`- }+ const certificateDetailUrl = `${getAzureKeyVaultCertificate.id}?api-version=7.4`;+ await blockLocalAndPrivateIpAddresses(certificateDetailUrl);+ const azureKeyVaultCertificate = await request.get<GetAzureKeyVaultCertificate>(certificateDetailUrl, {+ headers: {+ Authorization: `Bearer ${accessToken}`}- );+ });let certPem = "";if (azureKeyVaultCertificate.data.cer) {@@ -733,6 +736,8 @@ export const azureKeyVaultPkiSyncFactory = ({// Cast destination config to Azure Key Vault configconst destinationConfig = pkiSync.destinationConfig as TAzureKeyVaultPkiSyncConfig;+ await blockLocalAndPrivateIpAddresses(destinationConfig.vaultBaseUrl);+const existingSyncRecords = await certificateSyncDAL.findByPkiSyncId(pkiSync.id);const certificateNamesToRemove: string[] = [];const certificateIdToNameMap = new Map<string, string>();diff --git a/docs/integrations/app-connections/gitlab.mdx b/docs/integrations/app-connections/gitlab.mdxindex 6c45c4b30b..2db44b2786 100644--- a/docs/integrations/app-connections/gitlab.mdx+++ b/docs/integrations/app-connections/gitlab.mdx@@ -8,6 +8,10 @@ Infisical supports two methods for connecting to GitLab: **OAuth** and **Access<Tabs><Tab title="OAuth Method">The OAuth method provides secure authentication through GitLab's OAuth flow.++ <Info>+ Oauth Method is only supported in Self-Hosted mode.+ </Info><Accordion title="Self-Hosted Instance Setup">Using the GitLab Connection with OAuth on a self-hosted instance of Infisical requires configuring an OAuth application in GitLab and registering your instance with it.diff --git a/frontend/src/components/auth/UserInfoStep.tsx b/frontend/src/components/auth/UserInfoStep.tsxindex ba70fb5f8d..cda3114829 100644--- a/frontend/src/components/auth/UserInfoStep.tsx+++ b/frontend/src/components/auth/UserInfoStep.tsx@@ -137,7 +137,6 @@ export default function UserInfoStep({SecurityClient.setSignupToken("");SecurityClient.setToken(response.token);- SecurityClient.setProviderAuthToken("");if (isInfisicalCloud()) {window.dataLayer = window.dataLayer || [];diff --git a/frontend/src/components/utilities/SecurityClient.ts b/frontend/src/components/utilities/SecurityClient.tsindex c886a45ace..3b63d3d205 100644--- a/frontend/src/components/utilities/SecurityClient.ts+++ b/frontend/src/components/utilities/SecurityClient.ts@@ -1,17 +1,7 @@import { setAuthToken, setMfaTempToken, setSignupTempToken } from "@app/hooks/api/reactQuery";-export const PROVIDER_AUTH_TOKEN_KEY = "infisical__provider-auth-token";-// depreciated: go for apiRequest module in config/apiexport default class SecurityClient {- static setProviderAuthToken(tokenStr: string) {- localStorage.setItem(PROVIDER_AUTH_TOKEN_KEY, tokenStr || "");- }-- static getProviderAuthToken() {- return localStorage.getItem(PROVIDER_AUTH_TOKEN_KEY);- }-static setSignupToken(tokenStr: string) {setSignupTempToken(tokenStr);}diff --git a/frontend/src/components/utilities/attemptCliLogin.ts b/frontend/src/components/utilities/attemptCliLogin.tsindex d0f8fca241..d7530dc378 100644--- a/frontend/src/components/utilities/attemptCliLogin.ts+++ b/frontend/src/components/utilities/attemptCliLogin.ts@@ -30,7 +30,6 @@ const attemptLogin = async ({captchaToken});- SecurityClient.setProviderAuthToken("");SecurityClient.setToken(data.accessToken);if (email) {telemetry.identify(email, email);diff --git a/frontend/src/components/utilities/attemptLogin.ts b/frontend/src/components/utilities/attemptLogin.tsindex 8e918fe0ca..7c43f63b5f 100644--- a/frontend/src/components/utilities/attemptLogin.ts+++ b/frontend/src/components/utilities/attemptLogin.ts@@ -2,7 +2,6 @@ import { loginV3 } from "@app/hooks/api/auth/queries";import { setAuthToken } from "@app/hooks/api/reactQuery";import Telemetry from "./telemetry/Telemetry";-import SecurityClient from "./SecurityClient";export enum LoginMode {LegacySrp = "legacy-srp",@@ -39,7 +38,6 @@ const attemptLogin = async ({captchaToken});- SecurityClient.setProviderAuthToken("");setAuthToken(data.accessToken);if (email) {diff --git a/frontend/src/config/request.ts b/frontend/src/config/request.tsindex 51ff948bb6..eddb50588c 100644--- a/frontend/src/config/request.ts+++ b/frontend/src/config/request.ts@@ -26,7 +26,6 @@ apiRequest.interceptors.request.use((config) => {const signupTempToken = getSignupTempToken();const mfaTempToken = getMfaTempToken();const token = getAuthToken();- const providerAuthToken = SecurityClient.getProviderAuthToken();if (config.headers) {if (mfaTempToken) {@@ -38,9 +37,6 @@ apiRequest.interceptors.request.use((config) => {} else if (signupTempToken) {// eslint-disable-next-line no-param-reassignconfig.headers.Authorization = `Bearer ${signupTempToken}`;- } else if (providerAuthToken) {- // eslint-disable-next-line no-param-reassign- config.headers.Authorization = `Bearer ${providerAuthToken}`;}}diff --git a/frontend/src/const.ts b/frontend/src/const.tsindex 806755f380..6c81ef12fc 100644--- a/frontend/src/const.ts+++ b/frontend/src/const.ts@@ -20,8 +20,7 @@ export const publicPaths = ["/verify-email","/password-reset","/saml-sso",- "/login/provider/success", // TODO: change- "/login/provider/error", // TODO: change+ "/login/provider/error","/login/sso","/admin/signup","/shared/secret/[id]",diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.tsindex de5a7f53c3..425cbb7bb3 100644--- a/frontend/src/const/routes.ts+++ b/frontend/src/const/routes.ts@@ -11,10 +11,6 @@ export const ROUTE_PATHS = Object.freeze({"/login/select-organization","/_restrict-login-signup/login/select-organization"),- ProviderSuccessPage: setRoute(- "/login/provider/success",- "/_restrict-login-signup/login/provider/success"- ),SignUpSsoPage: setRoute("/signup/sso", "/_restrict-login-signup/signup/sso"),AccountRecoveryResetPage: setRoute("/account-recovery-reset",diff --git a/frontend/src/hooks/api/auth/queries.tsx b/frontend/src/hooks/api/auth/queries.tsxindex f920941544..3e906f0e35 100644--- a/frontend/src/hooks/api/auth/queries.tsx+++ b/frontend/src/hooks/api/auth/queries.tsx@@ -80,7 +80,6 @@ export const useSelectOrganization = () => {// If a custom user agent is set, then this session is meant for another consuming application, not the web application.if (!details.userAgent && !data.isMfaEnabled) {SecurityClient.setToken(data.token);- SecurityClient.setProviderAuthToken("");}if (data.token && !data.isMfaEnabled) {diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsxindex 048f40c207..d9e205634a 100644--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx@@ -216,7 +216,6 @@ export const Navbar = () => {}SecurityClient.setToken(token);- SecurityClient.setProviderAuthToken("");queryClient.removeQueries({ queryKey: authKeys.getAuthToken });queryClient.removeQueries({ queryKey: subOrgQuery.queryKey });diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/NewSubOrganizationForm.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/NewSubOrganizationForm.tsxindex 92fc3cc82c..170d5feee1 100644--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/NewSubOrganizationForm.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/NewSubOrganizationForm.tsx@@ -48,7 +48,6 @@ export const NewSubOrganizationForm = ({ onClose, handleOrgSelection }: ContentP});SecurityClient.setToken(token);- SecurityClient.setProviderAuthToken("");}const { organization } = await createSubOrg.mutateAsync({diff --git a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsxindex 7119e23944..c08592f4fd 100644--- a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx+++ b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx@@ -83,14 +83,14 @@ export const InitialStep = ({ setSection, isAdmin }: Props) => {const redirectToSaml = (orgSlug: string) => {const redirectUrl = `/api/v1/sso/redirect/saml2/organizations/${orgSlug}${- callbackPort ? `?callback_port=${callbackPort}` : ""+ callbackPort ? `?callback_port=${encodeURIComponent(callbackPort)}` : ""}`;window.location.assign(redirectUrl);};const redirectToOidc = (orgSlug: string) => {const redirectUrl = `/api/v1/sso/oidc/login?orgSlug=${orgSlug}${- callbackPort ? `&callbackPort=${callbackPort}` : ""+ callbackPort ? `&callbackPort=${encodeURIComponent(callbackPort)}` : ""}`;window.location.assign(redirectUrl);};diff --git a/frontend/src/pages/auth/LoginPage/components/SSOStep/SSOStep.tsx b/frontend/src/pages/auth/LoginPage/components/SSOStep/SSOStep.tsxindex ecaa2660e6..f7fe1a808e 100644--- a/frontend/src/pages/auth/LoginPage/components/SSOStep/SSOStep.tsx+++ b/frontend/src/pages/auth/LoginPage/components/SSOStep/SSOStep.tsx@@ -38,11 +38,11 @@ export const SSOStep = ({ setSection, type }: Props) => {if (type === "SAML") {window.location.href = `/api/v1/sso/redirect/saml2/organizations/domain/${identifier}${- callbackPort ? `?callback_port=${callbackPort}` : ""+ callbackPort ? `?callback_port=${encodeURIComponent(callbackPort)}` : ""}`;} else {window.location.href = `/api/v1/sso/oidc/login?domain=${identifier}${- callbackPort ? `&callbackPort=${callbackPort}` : ""+ callbackPort ? `&callbackPort=${encodeURIComponent(callbackPort)}` : ""}`;}};diff --git a/frontend/src/pages/auth/ProviderSuccessPage/ProviderSuccessPage.tsx b/frontend/src/pages/auth/ProviderSuccessPage/ProviderSuccessPage.tsxdeleted file mode 100644index 827ccf21b8..0000000000--- a/frontend/src/pages/auth/ProviderSuccessPage/ProviderSuccessPage.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { useEffect } from "react";-import { useSearch } from "@tanstack/react-router";--import SecurityClient from "@app/components/utilities/SecurityClient";-import { ROUTE_PATHS } from "@app/const/routes";--export const LoginProviderSuccessPage = () => {- const search = useSearch({- from: ROUTE_PATHS.Auth.ProviderSuccessPage.id- });-- useEffect(() => {- SecurityClient.setProviderAuthToken(search.token);- window.close();- }, []);-- return <div />;-};diff --git a/frontend/src/pages/auth/ProviderSuccessPage/route.tsx b/frontend/src/pages/auth/ProviderSuccessPage/route.tsxdeleted file mode 100644index df71b2cb4d..0000000000--- a/frontend/src/pages/auth/ProviderSuccessPage/route.tsx+++ /dev/null@@ -1,14 +0,0 @@-import { createFileRoute } from "@tanstack/react-router";-import { zodValidator } from "@tanstack/zod-adapter";-import { z } from "zod";--import { LoginProviderSuccessPage } from "./ProviderSuccessPage";--const LoginProviderSuccessQuerySchema = z.object({- token: z.string()-});--export const Route = createFileRoute("/_restrict-login-signup/login/provider/success")({- component: LoginProviderSuccessPage,- validateSearch: zodValidator(LoginProviderSuccessQuerySchema)-});diff --git a/frontend/src/pages/middlewares/inject-org-details.tsx b/frontend/src/pages/middlewares/inject-org-details.tsxindex e84189d552..3692bab8ec 100644--- a/frontend/src/pages/middlewares/inject-org-details.tsx+++ b/frontend/src/pages/middlewares/inject-org-details.tsx@@ -40,7 +40,6 @@ export const Route = createFileRoute("/_authenticate/_inject-org-details")({if (!isMfaEnabled && token) {SecurityClient.setToken(token);- SecurityClient.setProviderAuthToken("");context.queryClient.removeQueries({ queryKey: authKeys.getAuthToken });context.queryClient.removeQueries({ queryKey: projectKeys.getAllUserProjects() });diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsxindex e9af41aaa7..88ccd29114 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/GitLabConnectionForm.tsx@@ -221,10 +221,10 @@ export const GitLabConnectionForm = ({ appConnection, onSubmit: formSubmit, proj}. This field cannot be changed after creation.`}errorText={!isLoading && isMissingConfig && selectedMethod === GitLabConnectionMethod.OAuth- ? `Environment variables have not been configured. ${+ ? `${isInfisicalCloud()- ? "Please contact Infisical."- : `See Docs to configure GitLab ${methodDetails.name} Connections.`+ ? "GitLab Oauth is not supported in Infisical Cloud."+ : `Environment variables have not been configured. See Docs to configure GitLab ${methodDetails.name} Connections.`}`: error?.message}diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsxindex f12c7792fb..56ea41448c 100644--- a/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSubOrgsTab/OrgSubOrgsTab.tsx@@ -178,7 +178,6 @@ export const OrgSubOrgsTab = () => {}SecurityClient.setToken(token);- SecurityClient.setProviderAuthToken("");queryClient.removeQueries({ queryKey: authKeys.getAuthToken });await queryClient.refetchQueries({ queryKey: authKeys.getAuthToken });await navigateUserToOrg({ navigate, organizationId: subOrgId });diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.tsindex c2bf1cc282..a61ff38f12 100644--- a/frontend/src/routeTree.gen.ts+++ b/frontend/src/routeTree.gen.ts@@ -40,7 +40,6 @@ import { Route as MfaSessionPageRouteImport } from './pages/MfaSessionPage/routeimport { Route as authSignUpPageRouteImport } from './pages/auth/SignUpPage/route'import { Route as authLoginPageRouteImport } from './pages/auth/LoginPage/route'import { Route as adminLayoutImport } from './pages/admin/layout'-import { Route as authProviderSuccessPageRouteImport } from './pages/auth/ProviderSuccessPage/route'import { Route as authProviderErrorPageRouteImport } from './pages/auth/ProviderErrorPage/route'import { Route as userPersonalSettingsPageRouteImport } from './pages/user/PersonalSettingsPage/route'import { Route as adminIntegrationsPageRouteImport } from './pages/admin/IntegrationsPage/route'@@ -613,13 +612,6 @@ const AuthenticateInjectOrgDetailsOrgLayoutIntegrationsRoute =getParentRoute: () => organizationLayoutRoute,} as any)-const authProviderSuccessPageRouteRoute =- authProviderSuccessPageRouteImport.update({- id: '/provider/success',- path: '/provider/success',- getParentRoute: () => RestrictLoginSignupLoginRoute,- } as any)-const authProviderErrorPageRouteRoute = authProviderErrorPageRouteImport.update({id: '/provider/error',@@ -2827,13 +2819,6 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof authProviderErrorPageRouteImportparentRoute: typeof RestrictLoginSignupLoginImport}- '/_restrict-login-signup/login/provider/success': {- id: '/_restrict-login-signup/login/provider/success'- path: '/provider/success'- fullPath: '/login/provider/success'- preLoaderRoute: typeof authProviderSuccessPageRouteImport- parentRoute: typeof RestrictLoginSignupLoginImport- }'/_authenticate/_inject-org-details/_org-layout/integrations': {id: '/_authenticate/_inject-org-details/_org-layout/integrations'path: '/integrations'@@ -5900,7 +5885,6 @@ interface RestrictLoginSignupLoginRouteChildren {authLoginLdapPageRouteRoute: typeof authLoginLdapPageRouteRouteauthSelectOrgPageRouteRoute: typeof authSelectOrgPageRouteRouteauthProviderErrorPageRouteRoute: typeof authProviderErrorPageRouteRoute- authProviderSuccessPageRouteRoute: typeof authProviderSuccessPageRouteRoute}const RestrictLoginSignupLoginRouteChildren: RestrictLoginSignupLoginRouteChildren =@@ -5910,7 +5894,6 @@ const RestrictLoginSignupLoginRouteChildren: RestrictLoginSignupLoginRouteChildrauthLoginLdapPageRouteRoute: authLoginLdapPageRouteRoute,authSelectOrgPageRouteRoute: authSelectOrgPageRouteRoute,authProviderErrorPageRouteRoute: authProviderErrorPageRouteRoute,- authProviderSuccessPageRouteRoute: authProviderSuccessPageRouteRoute,}const RestrictLoginSignupLoginRouteWithChildren =@@ -5993,7 +5976,6 @@ export interface FileRoutesByFullPath {'/admin': typeof adminLayoutRouteWithChildren'/personal-settings/': typeof userPersonalSettingsPageRouteRoute'/login/provider/error': typeof authProviderErrorPageRouteRoute- '/login/provider/success': typeof authProviderSuccessPageRouteRoute'/integrations': typeof AuthenticateInjectOrgDetailsOrgLayoutIntegrationsRouteWithChildren'/admin/': typeof adminGeneralPageRouteRoute'/admin/access-management': typeof adminAccessManagementPageRouteRoute@@ -6271,7 +6253,6 @@ export interface FileRoutesByTo {'/shared/secret/$secretId': typeof publicViewSharedSecretByIDPageRouteRoute'/admin': typeof adminGeneralPageRouteRoute'/login/provider/error': typeof authProviderErrorPageRouteRoute- '/login/provider/success': typeof authProviderSuccessPageRouteRoute'/integrations': typeof AuthenticateInjectOrgDetailsOrgLayoutIntegrationsRouteWithChildren'/admin/access-management': typeof adminAccessManagementPageRouteRoute'/admin/authentication': typeof adminAuthenticationPageRouteRoute@@ -6534,7 +6515,6 @@ export interface FileRoutesById {'/_authenticate/personal-settings/_layout': typeof userLayoutRouteWithChildren'/_authenticate/personal-settings/_layout/': typeof userPersonalSettingsPageRouteRoute'/_restrict-login-signup/login/provider/error': typeof authProviderErrorPageRouteRoute- '/_restrict-login-signup/login/provider/success': typeof authProviderSuccessPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/integrations': typeof AuthenticateInjectOrgDetailsOrgLayoutIntegrationsRouteWithChildren'/_authenticate/_inject-org-details/admin/_admin-layout': typeof adminLayoutRouteWithChildren'/_authenticate/_inject-org-details/admin/_admin-layout/': typeof adminGeneralPageRouteRoute@@ -6825,7 +6805,6 @@ export interface FileRouteTypes {| '/admin'| '/personal-settings/'| '/login/provider/error'- | '/login/provider/success'| '/integrations'| '/admin/'| '/admin/access-management'@@ -7102,7 +7081,6 @@ export interface FileRouteTypes {| '/shared/secret/$secretId'| '/admin'| '/login/provider/error'- | '/login/provider/success'| '/integrations'| '/admin/access-management'| '/admin/authentication'@@ -7363,7 +7341,6 @@ export interface FileRouteTypes {| '/_authenticate/personal-settings/_layout'| '/_authenticate/personal-settings/_layout/'| '/_restrict-login-signup/login/provider/error'- | '/_restrict-login-signup/login/provider/success'| '/_authenticate/_inject-org-details/_org-layout/integrations'| '/_authenticate/_inject-org-details/admin/_admin-layout'| '/_authenticate/_inject-org-details/admin/_admin-layout/'@@ -7748,8 +7725,7 @@ export const routeTree = rootRoute"/_restrict-login-signup/login/admin","/_restrict-login-signup/login/ldap","/_restrict-login-signup/login/select-organization",- "/_restrict-login-signup/login/provider/error",- "/_restrict-login-signup/login/provider/success"+ "/_restrict-login-signup/login/provider/error"]},"/_restrict-login-signup/signup": {@@ -7836,10 +7812,6 @@ export const routeTree = rootRoute"filePath": "auth/ProviderErrorPage/route.tsx","parent": "/_restrict-login-signup/login"},- "/_restrict-login-signup/login/provider/success": {- "filePath": "auth/ProviderSuccessPage/route.tsx",- "parent": "/_restrict-login-signup/login"- },"/_authenticate/_inject-org-details/_org-layout/integrations": {"filePath": "","parent": "/_authenticate/_inject-org-details/_org-layout",diff --git a/frontend/src/routes.ts b/frontend/src/routes.tsindex ab7b7016d8..20be7e2964 100644--- a/frontend/src/routes.ts+++ b/frontend/src/routes.ts@@ -463,7 +463,6 @@ export const routes = rootRoute("root.tsx", [route("/admin", "auth/AdminLoginPage/route.tsx"),route("/select-organization", "auth/SelectOrgPage/route.tsx"),route("/ldap", "auth/LoginLdapPage/route.tsx"),- route("/provider/success", "auth/ProviderSuccessPage/route.tsx"),route("/provider/error", "auth/ProviderErrorPage/route.tsx")]),route("/signup", [