mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Sanitize sourceURL so it cannot affect evaled code (#4518)
This commit is contained in:
12
test/test.js
12
test/test.js
@@ -22641,6 +22641,18 @@
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
QUnit.test('should not let a sourceURL inject code', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var actual,
|
||||
expected = 'no error';
|
||||
try {
|
||||
actual = _.template(expected, {'sourceURL': '\u2028\u2029\n!this would err if it was executed!'})();
|
||||
} catch (e) {}
|
||||
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
QUnit.test('should work as an iteratee for methods like `_.map`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user