@@ -8,16 +8,7 @@ import javascript
88deprecated import semmle.javascript.dataflow.Configuration
99import semmle.javascript.dataflow.internal.CallGraphs
1010private import semmle.javascript.internal.CachedStages
11-
12- /**
13- * Holds if flow should be tracked through properties of `obj`.
14- *
15- * Flow is tracked through `module` and `module.exports` objects.
16- */
17- predicate shouldTrackProperties ( AbstractValue obj ) {
18- obj instanceof AbstractExportsObject or
19- obj instanceof AbstractModuleObject
20- }
11+ private import semmle.javascript.internal.NameResolution
2112
2213/**
2314 * Holds if `source` corresponds to an expression returned by `f`, and
@@ -337,28 +328,16 @@ private module CachedSteps {
337328 )
338329 }
339330
340- /**
341- * Holds if there is an assignment to property `prop` of an object represented by `obj`
342- * with right hand side `rhs` somewhere, and properties of `obj` should be tracked.
343- */
344- pragma [ noinline]
345- private predicate trackedPropertyWrite ( AbstractValue obj , string prop , DataFlow:: Node rhs ) {
346- exists ( AnalyzedPropertyWrite pw |
347- pw .writes ( obj , prop , rhs ) and
348- shouldTrackProperties ( obj ) and
349- // avoid introducing spurious global flow
350- not pw .baseIsIncomplete ( "global" )
351- )
352- }
353-
354331 /**
355332 * Holds if there is a flow step from `pred` to `succ` through an object property.
356333 */
357334 cached
358335 predicate propertyFlowStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
359- exists ( AbstractValue obj , string prop |
360- trackedPropertyWrite ( obj , prop , pred ) and
361- succ .( AnalyzedPropertyRead ) .reads ( obj , prop )
336+ // TODO: Ensure name resolution has good enough support for NodeJS and AMD
337+ exists ( NameResolution:: Node node1 , NameResolution:: Node node2 |
338+ NameResolution:: ValueFlow:: resolvedReadStep ( node1 , node2 ) and
339+ pred = DataFlow:: valueNode ( node1 ) and
340+ succ = DataFlow:: valueNode ( node2 )
362341 )
363342 }
364343
0 commit comments