Skip to content

Commit

Permalink
fixup! Sanitize sourceURL so it cannot affect evaled code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbrasetvik committed Oct 17, 2019
1 parent 2fa5232 commit d2770b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lodash.js
Expand Up @@ -14822,7 +14822,7 @@
// to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
// and escape the comment, thus injecting code that gets evaled.
var sourceURL = '//# sourceURL=' + (
options.sourceURL
hasOwnProperty.call(options, 'sourceURL')
? (options.sourceURL + '').replace(/\s/g, ' ')
: ('lodash.templateSources[' + (++templateCounter) + ']')
) + '\n';
Expand Down Expand Up @@ -14856,7 +14856,7 @@

// If `variable` is not specified wrap a with-statement around the generated
// code to add the data object to the top of the scope chain.
var variable = options.variable;
var variable = hasOwnProperty.call(options, 'variable') && options.variable;
if (!variable) {
source = 'with (obj) {\n' + source + '\n}\n';
}
Expand Down

0 comments on commit d2770b2

Please sign in to comment.