Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Remove Pangea

Steven Tey7f596c39ed68
diff --git a/README.md b/README.md
index b22fbe493a..730e43b7e3 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,6 @@ Our platform powers 100M+ clicks and 2M+ links monthly, and is used by world-cla
- [Stripe](https://stripe.com/) – payments
- [Resend](https://resend.com/) – emails
- [Vercel](https://vercel.com/) – deployments
-- [Pangea](https://pangea.cloud/services/domain-intel/reputation) - link scanning
## Self-Hosting
diff --git a/apps/web/.env.example b/apps/web/.env.example
index 3be3285c8a..4bdb4ffd79 100644
--- a/apps/web/.env.example
+++ b/apps/web/.env.example
@@ -119,10 +119,6 @@ NEXT_PUBLIC_IS_DUB=
# For cron jobs
CRON_SECRET=
-# Pangea - Retrieve reputation for a domain.
-# Get your Pange API Key here: https://pangea.cloud/docs/admin-guide/tokens/
-PANGEA_API_KEY=
-
# Slack integration
SLACK_APP_INSTALL_URL=
SLACK_CLIENT_ID=
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts
index 6a4cf6c808..aa6d4e360b 100644
--- a/apps/web/lib/api/links/process-link.ts
+++ b/apps/web/lib/api/links/process-link.ts
@@ -1,6 +1,5 @@
-import { isBlacklistedDomain, updateConfig } from "@/lib/edge-config";
+import { isBlacklistedDomain } from "@/lib/edge-config";
import { verifyFolderAccess } from "@/lib/folder/permissions";
-import { getPangeaDomainIntel } from "@/lib/pangea";
import { checkIfUserExists, getRandomKey } from "@/lib/planetscale";
import { isStored } from "@/lib/storage";
import { NewLinkProps, ProcessedLinkProps, WorkspaceProps } from "@/lib/types";
@@ -14,7 +13,6 @@ import {
getUrlFromString,
isDubDomain,
isValidUrl,
- log,
parseDateTime,
pluralize,
} from "@dub/utils";
@@ -570,7 +568,7 @@ export async function processLink<T extends Record<string, any>>({
}
async function maliciousLinkCheck(url: string) {
- const [domain, apexDomain] = [getDomainWithoutWWW(url), getApexDomain(url)];
+ const domain = getDomainWithoutWWW(url);
if (!domain) {
return false;
@@ -579,38 +577,6 @@ async function maliciousLinkCheck(url: string) {
const domainBlacklisted = await isBlacklistedDomain(domain);
if (domainBlacklisted === true) {
return true;
- } else if (domainBlacklisted === "whitelisted") {
- return false;
- }
-
- // Check with Pangea for domain reputation
- if (process.env.PANGEA_API_KEY) {
- try {
- const response = await getPangeaDomainIntel(domain);
-
- const verdict = response.result.data[apexDomain].verdict;
- console.log("Pangea verdict for domain", apexDomain, verdict);
-
- if (verdict === "benign") {
- return false;
- } else if (verdict === "malicious" || verdict === "suspicious") {
- await Promise.all([
- updateConfig({
- key: "domains",
- value: domain,
- }),
- log({
- message: `Suspicious link detected via Pangea → ${url}`,
- type: "links",
- mention: true,
- }),
- ]);
-
- return true;
- }
- } catch (e) {
- console.error("Error checking domain with Pangea", e);
- }
}
return false;
diff --git a/apps/web/lib/edge-config/is-blacklisted-domain.ts b/apps/web/lib/edge-config/is-blacklisted-domain.ts
index 659e8e5597..1c71a12fed 100644
--- a/apps/web/lib/edge-config/is-blacklisted-domain.ts
+++ b/apps/web/lib/edge-config/is-blacklisted-domain.ts
@@ -1,8 +1,6 @@
import { getAll } from "@vercel/edge-config";
-export const isBlacklistedDomain = async (
- domain: string,
-): Promise<boolean | "whitelisted"> => {
+export const isBlacklistedDomain = async (domain: string): Promise<boolean> => {
if (!process.env.NEXT_PUBLIC_IS_DUB || !process.env.EDGE_CONFIG) {
return false;
}
@@ -20,7 +18,7 @@ export const isBlacklistedDomain = async (
if (whitelistedDomains.includes(domain)) {
console.log("Domain is whitelisted", domain);
- return "whitelisted";
+ return false;
}
const blacklistedTermsRegex = new RegExp(
diff --git a/apps/web/lib/pangea.ts b/apps/web/lib/pangea.ts
deleted file mode 100644
index 0877d9243f..0000000000
--- a/apps/web/lib/pangea.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export const getPangeaDomainIntel = async (domain: string) => {
- return fetch("https://domain-intel.aws.us.pangea.cloud/v2/reputation", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${process.env.PANGEA_API_KEY}`,
- },
- body: JSON.stringify({
- domains: [domain],
- }),
- }).then((res) => res.json());
-};