Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1119 from lirantal/bugfix/xss_and_validations
Browse files Browse the repository at this point in the history
fix(security): fixing possible xss issue in parsed objects
  • Loading branch information
lirantal committed Jan 2, 2016
2 parents 169d4cd + 2b0ae86 commit b9e3fd1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion modules/core/server/controllers/core.server.controller.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
'use strict';

var validator = require('validator');

/**
* Render the main application page
*/
exports.renderIndex = function (req, res) {

var safeUserObject = null;
if (req.user) {
safeUserObject = {
displayName: validator.escape(req.user.displayName),
provider: validator.escape(req.user.provider),
username: validator.escape(req.user.username),
created: req.user.created.toString(),
roles: req.user.roles,
profileImageURL: validator.escape(req.user.profileImageURL),
email: validator.escape(req.user.email),
lastName: validator.escape(req.user.lastName),
firstName: validator.escape(req.user.firstName)
};
}

res.render('modules/core/server/views/index', {
user: req.user || null
user: safeUserObject
});
};

Expand Down

0 comments on commit b9e3fd1

Please sign in to comment.