Skip to content

Commit e47ee0e

Browse files
committed
Address CR
1 parent ead9020 commit e47ee0e

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

apps/web/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@supabase/supabase-js": "^2.39.3",
2828
"@tailwindcss/typography": "^0.5.1",
2929
"@types/canvas-confetti": "^1.6.4",
30+
"@types/validator": "^13.15.3",
3031
"@vercel/og": "^0.0.20",
3132
"canvas-confetti": "^1.9.3",
3233
"chrono-node": "^2.7.6",
@@ -66,6 +67,7 @@
6667
"use-debounce": "^7.0.1",
6768
"use-file-picker": "^1.4.1",
6869
"uuid": "^8.3.2",
70+
"validator": "^13.15.15",
6971
"yup": "^1.3.3"
7072
},
7173
"devDependencies": {

apps/web/pages/api/pages/settings/remove-domain.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import isFQDN from "validator/lib/isFQDN";
12
import { withAuth } from "../../../../utils/withAuth";
23

34
const removeDomain = withAuth<{ success: boolean }>(
@@ -6,6 +7,13 @@ const removeDomain = withAuth<{ success: boolean }>(
67

78
console.log("removeDomain", user?.id, `domain: ${domain}`);
89

10+
if (
11+
typeof domain !== "string" ||
12+
!isFQDN(domain, { require_tld: true, allow_underscores: false })
13+
) {
14+
return res.status(400).json({ success: false });
15+
}
16+
917
const response = await fetch(
1018
`https://api.vercel.com/v8/projects/${process.env.VERCEL_PAGES_PROJECT_ID}/domains/${domain}?teamId=${process.env.VERCEL_TEAM_ID}`,
1119
{

pnpm-lock.yaml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)