5f47c4a682
Internet Explorer does not support the 'class Testclass {}' notation,
and tests are not compiled using babel.
closes #1497
29 lines
969 B
JavaScript
29 lines
969 B
JavaScript
describe('security issues', function() {
|
|
describe('GH-1495: Prevent Remote Code Execution via constructor', function() {
|
|
it('should not allow constructors to be accessed', function() {
|
|
shouldCompileTo('{{constructor.name}}', {}, '');
|
|
});
|
|
|
|
it('should allow the "constructor" property to be accessed if it is enumerable', function() {
|
|
shouldCompileTo('{{constructor.name}}', {'constructor': {
|
|
'name': 'here we go'
|
|
}}, 'here we go');
|
|
});
|
|
|
|
it('should allow prototype properties that are not constructors', function() {
|
|
function TestClass() {
|
|
}
|
|
|
|
Object.defineProperty(TestClass.prototype, 'abc', {
|
|
get: function() {
|
|
return 'xyz';
|
|
}
|
|
|
|
});
|
|
|
|
shouldCompileTo('{{#with this as |obj|}}{{obj.abc}}{{/with}}',
|
|
new TestClass(), 'xyz');
|
|
});
|
|
});
|
|
});
|