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 11import { expect } from 'chai' ;
22import { deepAssign } from '../../../src/shared/object' ;
3+ import { addScopeOptions } from '../../../src/scopes/scope-service' ;
34
45describe ( 'utils' , ( ) => {
56 describe ( 'object' , ( ) => {
@@ -109,6 +110,14 @@ describe('utils', () => {
109110 expect ( copy . test ) . to . have . property ( 'protoFn' ) . that . is . a ( 'function' ) ;
110111 } ) ;
111112
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+
112121 if ( Object . getOwnPropertySymbols ) {
113122 it ( 'should copy symbol based objects' , ( ) => {
114123 const symbol = Symbol ( 'test' ) ;
You can’t perform that action at this time.
0 commit comments