@@ -14,6 +14,20 @@ describe('Convict prototype pollution resistance', function() {
1414 config . set ( '__proto__.nested.polluted_proto_nested' , 'Polluted!' )
1515 expect ( { } ) . not . toHaveProperty ( 'nested' )
1616 expect ( { } ) . not . toHaveProperty ( 'nested.polluted_proto_nested' )
17+
18+ config . set ( 'this.__proto__.polluted_proto_root' , 'Polluted!' )
19+ expect ( { } ) . not . toHaveProperty ( 'polluted_proto_root' )
20+
21+ config . set ( 'this.__proto__.nested.polluted_proto_nested' , 'Polluted!' )
22+ expect ( { } ) . not . toHaveProperty ( 'nested' )
23+ expect ( { } ) . not . toHaveProperty ( 'nested.polluted_proto_nested' )
24+
25+ config . set ( 'foo.__proto__.polluted_proto_root' , 'Polluted!' )
26+ expect ( { } ) . not . toHaveProperty ( 'polluted_proto_root' )
27+
28+ config . set ( 'foo.__proto__.nested.polluted_proto_nested' , 'Polluted!' )
29+ expect ( { } ) . not . toHaveProperty ( 'nested' )
30+ expect ( { } ) . not . toHaveProperty ( 'nested.polluted_proto_nested' )
1731 } )
1832
1933 test ( 'against this.constructor.prototype' , function ( ) {
@@ -26,6 +40,20 @@ describe('Convict prototype pollution resistance', function() {
2640 config . set ( 'this.constructor.prototype.nested.polluted_constructor_prototype_nested' , 'Polluted!' )
2741 expect ( { } ) . not . toHaveProperty ( 'nested' )
2842 expect ( { } ) . not . toHaveProperty ( 'nested.polluted_constructor_prototype_nested' )
43+
44+ config . set ( 'this.this.constructor.prototype.polluted_constructor_prototype_root' , 'Polluted!' )
45+ expect ( { } ) . not . toHaveProperty ( 'polluted_constructor_prototype_root' )
46+
47+ config . set ( 'this.this.constructor.prototype.nested.polluted_constructor_prototype_nested' , 'Polluted!' )
48+ expect ( { } ) . not . toHaveProperty ( 'nested' )
49+ expect ( { } ) . not . toHaveProperty ( 'nested.polluted_constructor_prototype_nested' )
50+
51+ config . set ( 'foo.this.constructor.prototype.polluted_constructor_prototype_root' , 'Polluted!' )
52+ expect ( { } ) . not . toHaveProperty ( 'polluted_constructor_prototype_root' )
53+
54+ config . set ( 'foo.this.constructor.prototype.nested.polluted_constructor_prototype_nested' , 'Polluted!' )
55+ expect ( { } ) . not . toHaveProperty ( 'nested' )
56+ expect ( { } ) . not . toHaveProperty ( 'nested.polluted_constructor_prototype_nested' )
2957 } )
3058
3159} )
0 commit comments