File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai' ;
2
2
import { deepAssign } from '../../../src/shared/object' ;
3
+ import { addScopeOptions } from '../../../src/scopes/scope-service' ;
3
4
4
5
describe ( 'utils' , ( ) => {
5
6
describe ( 'object' , ( ) => {
@@ -109,6 +110,14 @@ describe('utils', () => {
109
110
expect ( copy . test ) . to . have . property ( 'protoFn' ) . that . is . a ( 'function' ) ;
110
111
} ) ;
111
112
113
+ it ( 'ignore prototype property' , ( ) => {
114
+ const BAD_JSON = JSON . parse ( '{"__proto__":{"polluted":true}}' ) ;
115
+ const empty_scope = { } ;
116
+
117
+ addScopeOptions ( empty_scope , BAD_JSON ) ;
118
+ expect ( empty_scope ) . not . to . have . property ( 'polluted' ) ;
119
+ } ) ;
120
+
112
121
if ( Object . getOwnPropertySymbols ) {
113
122
it ( 'should copy symbol based objects' , ( ) => {
114
123
const symbol = Symbol ( 'test' ) ;
You can’t perform that action at this time.
0 commit comments