@@ -241,12 +241,18 @@ describe('set', function () {
241
241
objectPath . set ( { } , '__proto__.injected' , 'this is bad' )
242
242
expect ( Object . prototype . injected ) . to . be . undefined
243
243
244
+ objectPath . set ( { } , [ [ '__proto__' ] , 'injected' ] , 'this is bad' )
245
+ expect ( Object . prototype . injected ) . to . be . undefined
246
+
244
247
function Clazz ( ) { }
245
248
Clazz . prototype . test = 'original'
246
249
247
250
objectPath . set ( new Clazz ( ) , '__proto__.test' , 'this is bad' )
248
251
expect ( Clazz . prototype . test ) . to . be . equal ( 'original' )
249
252
253
+ objectPath . set ( new Clazz ( ) , [ [ '__proto__' ] , 'test' ] , 'this is bad' )
254
+ expect ( Clazz . prototype . test ) . to . be . equal ( 'original' )
255
+
250
256
objectPath . set ( new Clazz ( ) , 'constructor.prototype.test' , 'this is bad' )
251
257
expect ( Clazz . prototype . test ) . to . be . equal ( 'original' )
252
258
} )
@@ -256,6 +262,11 @@ describe('set', function () {
256
262
. to . throw ( 'For security reasons' )
257
263
expect ( Object . prototype . injected ) . to . be . undefined
258
264
265
+ expect ( function ( ) {
266
+ objectPath . withInheritedProps . set ( { } , [ [ '__proto__' ] , 'injected' ] , 'this is bad' )
267
+ expect ( Object . prototype . injected ) . to . be . undefined
268
+ } ) . to . throw ( 'For security reasons' )
269
+
259
270
function Clazz ( ) { }
260
271
Clazz . prototype . test = 'original'
261
272
@@ -267,8 +278,11 @@ describe('set', function () {
267
278
. to . throw ( 'For security reasons' )
268
279
expect ( Clazz . prototype . test ) . to . be . equal ( 'original' )
269
280
270
- const obj = { }
271
- expect ( function ( ) { objectPath . withInheritedProps . set ( obj , 'constructor.prototype.injected' , 'this is OK' ) } )
281
+ expect ( function ( ) { objectPath . withInheritedProps . set ( { } , 'constructor.prototype.injected' , 'this is OK' ) } )
282
+ . to . throw ( 'For security reasons' )
283
+ expect ( Object . prototype . injected ) . to . be . undefined
284
+
285
+ expect ( function ( ) { objectPath . withInheritedProps . set ( { } , [ [ 'constructor' ] , 'prototype' , 'injected' ] , 'this is bad' ) } )
272
286
. to . throw ( 'For security reasons' )
273
287
expect ( Object . prototype . injected ) . to . be . undefined
274
288
} )
0 commit comments