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.

fix

Steven Teyd391ad1008d5
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts
index a8851f24c0..0af70ab19e 100644
--- a/apps/web/lib/api/links/process-link.ts
+++ b/apps/web/lib/api/links/process-link.ts
@@ -276,9 +276,11 @@ async function maliciousLinkCheck(url: string) {
return false;
}
- const domainBlacklisted = await isBlacklistedDomain(domain);
- if (domainBlacklisted) {
+ const domainBlacklisted = await isBlacklistedDomain({ domain, apexDomain });
+ if (domainBlacklisted === true) {
return true;
+ } else if (domainBlacklisted === "whitelisted") {
+ return false;
}
try {
diff --git a/apps/web/lib/edge-config.ts b/apps/web/lib/edge-config.ts
index e56562ab7f..34ae6525a8 100644
--- a/apps/web/lib/edge-config.ts
+++ b/apps/web/lib/edge-config.ts
@@ -1,7 +1,13 @@
import { getDomainWithoutWWW } from "@dub/utils";
import { get, getAll } from "@vercel/edge-config";
-export const isBlacklistedDomain = async (domain: string) => {
+export const isBlacklistedDomain = async ({
+ domain,
+ apexDomain,
+}: {
+ domain: string;
+ apexDomain: string;
+}): Promise<boolean | "whitelisted"> => {
if (!process.env.NEXT_PUBLIC_IS_DUB || !process.env.EDGE_CONFIG) {
return false;
}
@@ -17,8 +23,8 @@ export const isBlacklistedDomain = async (domain: string) => {
whitelistedDomains,
} = await getAll(["domains", "terms", "whitelistedDomains"]);
- if (whitelistedDomains.includes(domain)) {
- return false;
+ if (whitelistedDomains.includes(apexDomain)) {
+ return "whitelisted";
}
const blacklistedTermsRegex = new RegExp(