Skip to content

Commit 7e89b79

Browse files
committedMar 14, 2021
Un-document the fix for #2911 for the time being
1 parent 4c73526 commit 7e89b79

5 files changed

+5
-29
lines changed
 

‎modules/template.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ function escapeChar(match) {
2424
return '\\' + escapes[match];
2525
}
2626

27-
// In order to prevent third-party code injection through
28-
// `_.templateSettings.variable`, we test it against the following regular
29-
// expression. It is intentionally a bit more liberal than just matching valid
30-
// identifiers, but still prevents possible loopholes through defaults or
31-
// destructuring assignment.
3227
var bareIdentifier = /^\s*(\w|\$)+\s*$/;
3328

3429
// JavaScript micro-templating, similar to John Resig's implementation.
@@ -68,10 +63,7 @@ export default function template(text, settings, oldSettings) {
6863

6964
var argument = settings.variable;
7065
if (argument) {
71-
// Insure against third-party code injection.
72-
if (!bareIdentifier.test(argument)) throw new Error(
73-
'variable is not a bare identifier: ' + argument
74-
);
66+
if (!bareIdentifier.test(argument)) throw new Error(argument);
7567
} else {
7668
// If a variable is not specified, place data values in local scope.
7769
source = 'with(obj||{}){\n' + source + '}\n';

‎underscore-esm.js

+1-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎underscore-esm.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎underscore.js

+1-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎underscore.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.