Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Check the hostname value for legality to eliminate dirty data
榆木35cf14987637
diff --git a/lib/session.ts b/lib/session.tsindex 29ff694f6..2725f04cd 100644--- a/lib/session.ts+++ b/lib/session.ts@@ -30,6 +30,13 @@ export async function findSession(req: NextApiRequestCollect) {// Verify payloadconst { website: websiteId, hostname, screen, language } = payload;++ // Check the hostname value for legality to eliminate dirty data+ const validHostnameRegex = /^[\w-.]+$/;+ if (!validHostnameRegex.test(hostname)) {+ throw new Error('Invalid hostname.');+ }+if (!validate(websiteId)) {throw new Error('Invalid website ID.');}