File tree 2 files changed +22
-2
lines changed 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,28 @@ export function template(templateSpec, env) {
69
69
if ( ! ( name in obj ) ) {
70
70
throw new Exception ( '"' + name + '" not defined in ' + obj ) ;
71
71
}
72
- return obj [ name ] ;
72
+ return container . lookupProperty ( obj , name ) ;
73
+ } ,
74
+ lookupProperty : function ( parent , propertyName ) {
75
+ let result = parent [ propertyName ] ;
76
+ if ( result == null ) {
77
+ return result ;
78
+ }
79
+ if ( Object . prototype . hasOwnProperty . call ( parent , propertyName ) ) {
80
+ return result ;
81
+ }
82
+
83
+ if ( ! Utils . dangerousPropertyRegex . test ( String ( propertyName ) ) ) {
84
+ return result ;
85
+ }
86
+
87
+ return undefined ;
73
88
} ,
74
89
lookup : function ( depths , name ) {
75
90
const len = depths . length ;
76
91
for ( let i = 0 ; i < len ; i ++ ) {
77
- if ( depths [ i ] && depths [ i ] [ name ] != null ) {
92
+ let result = depths [ i ] && container . lookupProperty ( depths [ i ] , name ) ;
93
+ if ( result != null ) {
78
94
return depths [ i ] [ name ] ;
79
95
}
80
96
}
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ describe('security issues', function() {
2
2
describe ( 'GH-1495: Prevent Remote Code Execution via constructor' , function ( ) {
3
3
checkPropertyAccess ( { } ) ;
4
4
5
+ describe ( 'in compat-mode' , function ( ) {
6
+ checkPropertyAccess ( { compat : true } ) ;
7
+ } ) ;
8
+
5
9
describe ( 'in strict-mode' , function ( ) {
6
10
checkPropertyAccess ( { strict : true } ) ;
7
11
} ) ;
You can’t perform that action at this time.
0 commit comments