fix(api): reject all metrics requests for invalid domains

Add check for requested metric type before domain name check.
Only the referrer metrics use the domain name; all other metrics should be unaffected.

This partly closes #503
pull/506/head
Alexander Klein 2021-02-24 10:40:21 +01:00
parent 7eb0ca8034
commit a48cedb3f3
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ export default async (req, res) => {
const { id, type, start_at, end_at, domain, url } = req.query;
if (domain && !DOMAIN_REGEX.test(domain)) {
if (type === 'referrer' && domain && !DOMAIN_REGEX.test(domain)) {
return badRequest(res);
}