mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Merge pull request #2117 from yumusb/patch-3
Check the hostname value for legality to eliminate dirty data
This commit is contained in:
commit
7fe1236a5f
@ -30,6 +30,13 @@ export async function findSession(req: NextApiRequestCollect) {
|
|||||||
// Verify payload
|
// Verify payload
|
||||||
const { website: websiteId, hostname, screen, language } = payload;
|
const { 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)) {
|
if (!validate(websiteId)) {
|
||||||
throw new Error('Invalid website ID.');
|
throw new Error('Invalid website ID.');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user