File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
javascript/ql/src/semmle/javascript/dataflow Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,31 @@ class LocalObject extends DataFlow::SourceNode {
6767 not exposedAsReceiver ( this )
6868 }
6969
70+ pragma [ nomagic]
7071 predicate hasOwnProperty ( string name ) {
7172 // the property is defined in the initializer,
7273 any ( DataFlow:: PropWrite write ) .writes ( this , name , _) and
7374 // and it is never deleted
74- not exists ( DeleteExpr del , DataFlow:: PropRef ref |
75+ not hasDeleteWithName ( name ) and
76+ // and there is no deleted property with computed name
77+ not hasDeleteWithComputedProperty ( )
78+ }
79+
80+ pragma [ noinline]
81+ private predicate hasDeleteWithName ( string name ) {
82+ exists ( DeleteExpr del , DataFlow:: PropRef ref |
83+ del .getOperand ( ) .flow ( ) = ref and
84+ flowsTo ( ref .getBase ( ) ) and
85+ ref .getPropertyName ( ) = name
86+ )
87+ }
88+
89+ pragma [ noinline]
90+ private predicate hasDeleteWithComputedProperty ( ) {
91+ exists ( DeleteExpr del , DataFlow:: PropRef ref |
7592 del .getOperand ( ) .flow ( ) = ref and
7693 flowsTo ( ref .getBase ( ) ) and
77- ( ref . getPropertyName ( ) = name or not exists ( ref .getPropertyName ( ) ) )
94+ not exists ( ref .getPropertyName ( ) )
7895 )
7996 }
8097}
You can’t perform that action at this time.
0 commit comments