sec: Fix prototype pollution in webaccess module

This commit is contained in:
SamTV12345 2024-08-18 19:57:05 +02:00
parent 4ff00e278a
commit 852f282b03

View file

@ -177,6 +177,10 @@ const checkAccess = async (req:any, res:any, next: Function) => {
res.status(401).send('Authentication Required');
return;
}
if (ctx.username === '__proto__' || ctx.username === 'constructor' || ctx.username === 'prototype') {
res.end(403);
return;
}
settings.users[ctx.username].username = ctx.username;
// Make a shallow copy so that the password property can be deleted (to prevent it from
// appearing in logs or in the database) without breaking future authentication attempts.