Skip to content

Commit

Permalink
Blacklist 'root' option when looking for opts in data obj
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Nov 28, 2016
1 parent 3f38122 commit 3d447c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ function rethrow(err, str, filename, lineno){
function cpOptsInData(data, opts) {
_OPTS.forEach(function (p) {
if (typeof data[p] != 'undefined') {
// Disallow setting the root opt for includes via a passed data obj
// Unsanitized, parameterized use of `render` could allow the
// include directory to be reset, opening up the possibility of
// remote code execution
if (p == 'root') {
return;
}
opts[p] = data[p];
}
});
Expand Down

0 comments on commit 3d447c5

Please sign in to comment.