@@ -493,16 +493,20 @@ QUnit.module('prototype pollution protection', {
493493} , ( ) => {
494494
495495 test ( 'compileSetter logs error and skips assignment for __proto__ path fragment' , function ( assert ) {
496- SETTER ( '__proto__.pp_dx' ) ( { } , 'yes' , { functionsAsIs : true } ) ;
496+ const obj = { } ;
497+ SETTER ( '__proto__.pp_dx' ) ( obj , 'yes' , { functionsAsIs : true } ) ;
497498
498499 assert . strictEqual ( errors . log . calledWith ( 'E0123' , '__proto__' ) , true , 'should log E0123 for __proto__' ) ;
500+ assert . strictEqual ( obj . pp_dx , undefined , 'target object must not be modified' ) ;
499501 assert . strictEqual ( ( { } ) . pp_dx , undefined , 'Object.prototype must not be polluted' ) ;
500502 } ) ;
501503
502504 test ( 'compileSetter logs error and skips assignment for constructor path fragment' , function ( assert ) {
503- SETTER ( 'constructor.prototype.pp_dx' ) ( { } , 'yes' , { functionsAsIs : true } ) ;
505+ const obj = { } ;
506+ SETTER ( 'constructor.prototype.pp_dx' ) ( obj , 'yes' , { functionsAsIs : true } ) ;
504507
505508 assert . strictEqual ( errors . log . calledWith ( 'E0123' , 'constructor' ) , true , 'should log E0123 for constructor' ) ;
509+ assert . strictEqual ( obj . pp_dx , undefined , 'target object must not be modified' ) ;
506510 assert . strictEqual ( ( { } ) . pp_dx , undefined , 'Object.prototype must not be polluted' ) ;
507511 } ) ;
508512
@@ -511,6 +515,7 @@ QUnit.module('prototype pollution protection', {
511515 SETTER ( 'prototype.pp_dx' ) ( fn , 'yes' , { functionsAsIs : true } ) ;
512516
513517 assert . strictEqual ( errors . log . calledWith ( 'E0123' , 'prototype' ) , true , 'should log E0123 for prototype' ) ;
518+ assert . strictEqual ( fn . pp_dx , undefined , 'function object must not be modified' ) ;
514519 assert . strictEqual ( fn . prototype . pp_dx , undefined , 'function prototype must not be modified' ) ;
515520 } ) ;
516521
0 commit comments