mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-11 01:52:55 +01:00
fix: backport prototype vuln. fixes
This commit is contained in:
@@ -13,7 +13,7 @@ const logger = require('../logger');
|
||||
const plugins = require('../plugins');
|
||||
const ratelimit = require('../middleware/ratelimit');
|
||||
|
||||
const Namespaces = {};
|
||||
const Namespaces = Object.create(null);
|
||||
|
||||
const Sockets = module.exports;
|
||||
|
||||
@@ -123,7 +123,7 @@ async function onMessage(socket, payload) {
|
||||
const parts = eventName.toString().split('.');
|
||||
const namespace = parts[0];
|
||||
const methodToCall = parts.reduce((prev, cur) => {
|
||||
if (prev !== null && prev[cur]) {
|
||||
if (prev !== null && prev[cur] && (!prev.hasOwnProperty || prev.hasOwnProperty(cur))) {
|
||||
return prev[cur];
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user