mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +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
1 changed files with 7 additions and 0 deletions
|
|
@ -30,6 +30,13 @@ export async function findSession(req: NextApiRequestCollect) {
|
|||
// Verify 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)) {
|
||||
throw new Error('Invalid website ID.');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue