Skip to content

Commit

Permalink
sec: Fix prototype pollution in webaccess module
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed Aug 18, 2024
1 parent 4ff00e2 commit 852f282
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/node/hooks/express/webaccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 852f282

Please sign in to comment.