Skip to content

Commit

Permalink
sanitizes logiclayer query params
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Sep 16, 2022
1 parent 67bc628 commit a6cd0b8
Show file tree
Hide file tree
Showing 3 changed files with 540 additions and 62 deletions.
1 change: 1 addition & 0 deletions packages/logiclayer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"d3-collection": "^1.0.4",
"d3plus-common": "^1.0.2",
"mondrian-rest-client": "^1.1.4",
"perfect-express-sanitizer": "^1.0.9",
"promise-throttle": "^1.0.0",
"sequelize": "^4.13.10",
"yn": "^4.0.0"
Expand Down
5 changes: 4 additions & 1 deletion packages/logiclayer/src/api/logiclayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Sequelize = require("sequelize"),
findYears = require("../utils/findYears"),
multiSort = require("../utils/multiSort"),
path = require("path"),
{sanitize} = require("perfect-express-sanitizer"),
yn = require("yn");

const {CANON_LOGICLAYER_CUBE} = process.env;
Expand Down Expand Up @@ -73,6 +74,9 @@ function findKey(query, key, fallback) {
}
}
}

value = sanitize.prepareSanitize(value, {xss: true, noSql: true, sql: true, level: 5});

if (fallback instanceof Array && !(value instanceof Array)) {
value = value
.split(/\,([^\s\d])/g)
Expand Down Expand Up @@ -273,7 +277,6 @@ module.exports = function(app) {
const hierarchy = group.key;
const dim = dimensions.find(dim => dim.dimension === group.values[0].dimension);
const dimension = dim.alternate;
const ids = group.values.map(d => d.id);
if (dim.relation) {
cuts.push([{dimension, level: hierarchy, hierarchy: dim.relation}, group.values.map(d => d.id)]);
renames.push({[dimension]: dim.relation});
Expand Down
Loading

0 comments on commit a6cd0b8

Please sign in to comment.