mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix($parse): forbid __proto__ properties in angular expressions
__proto__ can be used to mess with global prototypes and it's deprecated. Therefore, blacklisting it seems like a good idea. BREAKING CHANGE: The (deprecated) __proto__ propery does not work inside angular expressions anymore.
This commit is contained in:
@@ -1106,6 +1106,22 @@ describe('parser', function() {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('__proto__', function() {
|
||||
it('should NOT allow access to __proto__', function() {
|
||||
expect(function() {
|
||||
scope.$eval('{}.__proto__.foo = 1');
|
||||
}).toThrowMinErr(
|
||||
'$parse', 'isecproto', 'Using __proto__ in Angular expressions is disallowed!'+
|
||||
' Expression: {}.__proto__.foo = 1');
|
||||
expect(function() {
|
||||
scope.$eval('{}["__pro"+"to__"].foo = 1');
|
||||
}).toThrowMinErr(
|
||||
'$parse', 'isecproto', 'Using __proto__ in Angular expressions is disallowed!'+
|
||||
' Expression: {}["__pro"+"to__"].foo = 1');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('constant', function() {
|
||||
it('should mark scalar value expressions as constant', inject(function($parse) {
|
||||
|
||||
Reference in New Issue
Block a user