Закрыта дыра безопасности
This commit is contained in:
@@ -3,8 +3,11 @@ const _ = require('lodash');
|
||||
|
||||
class MiscController extends BaseController {
|
||||
async getConfig(req, res) {
|
||||
if (Array.isArray(req.body.params))
|
||||
return _.pick(this.config, req.body.params);
|
||||
if (Array.isArray(req.body.params)) {
|
||||
const paramsSet = new Set(req.body.params);
|
||||
|
||||
return _.pick(this.config, this.config.webConfigParams.filter(x => paramsSet.has(x)));
|
||||
}
|
||||
//bad request
|
||||
res.status(400).send({error: 'params is not an array'});
|
||||
return false;
|
||||
|
||||
@@ -98,7 +98,9 @@ class WebSocketController {
|
||||
|
||||
async getConfig(req, ws) {
|
||||
if (Array.isArray(req.params)) {
|
||||
this.send(_.pick(this.config, req.params), req, ws);
|
||||
const paramsSet = new Set(req.params);
|
||||
|
||||
this.send(_.pick(this.config, this.config.webConfigParams.filter(x => paramsSet.has(x))), req, ws);
|
||||
} else {
|
||||
throw new Error('params is not an array');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user