Skip to content

Commit

Permalink
fix xss on discard route, fix data-uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Jun 27, 2018
1 parent b16c23f commit 6fb80e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion library.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var socketMethods = require('./websockets');


var async = module.parent.require('async'); var async = module.parent.require('async');
var nconf = module.parent.require('nconf'); var nconf = module.parent.require('nconf');
var validator = require('validator');


var plugin = module.exports; var plugin = module.exports;


Expand Down Expand Up @@ -173,7 +174,7 @@ plugin.build = function(data, callback) {
} }


if (req.query.cid) { if (req.query.cid) {
discardRoute = nconf.get('relative_path') + '/category/' + req.query.cid; discardRoute = nconf.get('relative_path') + '/category/' + validator.escape(String(req.query.cid));
} else if ((req.query.tid || req.query.pid)) { } else if ((req.query.tid || req.query.pid)) {
if (data.topicData) { if (data.topicData) {
discardRoute = nconf.get('relative_path') + '/topic/' + data.topicData.slug; discardRoute = nconf.get('relative_path') + '/topic/' + data.topicData.slug;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"compatibility": "^1.7.4" "compatibility": "^1.7.4"
}, },
"dependencies": { "dependencies": {
"screenfull": "3.0.0" "screenfull": "3.0.0",
"validator": "10.4.0"
} }
} }
2 changes: 1 addition & 1 deletion static/lib/composer.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ define('composer', [
if (!post_uuid && !postData) { if (!post_uuid && !postData) {
post_uuid = utils.generateUUID(); post_uuid = utils.generateUUID();
composer.posts[post_uuid] = postData = ajaxify.data; composer.posts[post_uuid] = postData = ajaxify.data;
postContainer.attr('id', 'cmp-uuid-' + post_uuid); postContainer.attr('data-uuid', post_uuid);
} }


var bodyEl = postContainer.find('textarea'); var bodyEl = postContainer.find('textarea');
Expand Down

0 comments on commit 6fb80e4

Please sign in to comment.