Skip to content

Commit c09563f

Browse files
committed
JS: Make more general-purpose data flow things local
1 parent b1418e1 commit c09563f

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

javascript/ql/lib/semmle/javascript/Extend.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
22
* Provides classes for reasoning about `extend`-like functions.
33
*/
4+
overlay[local]
5+
module;
46

57
import javascript
68

@@ -169,6 +171,7 @@ private class FunctionalExtendCallShallow extends ExtendCall {
169171
*
170172
* Since all object properties are preserved, we model this as a value-preserving step.
171173
*/
174+
overlay[global]
172175
private class ExtendCallStep extends PreCallGraphStep {
173176
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
174177
exists(ExtendCall extend |
@@ -184,6 +187,7 @@ private import semmle.javascript.dataflow.internal.PreCallGraphStep
184187
/**
185188
* A step through a cloning library, such as `clone` or `fclone`.
186189
*/
190+
overlay[global]
187191
private class CloneStep extends PreCallGraphStep {
188192
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
189193
exists(DataFlow::CallNode call |

javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/**
22
* Provides predicates for associating qualified names with data flow nodes.
33
*/
4+
overlay[local]
5+
module;
46

57
import javascript
68
private import semmle.javascript.dataflow.InferredTypes
@@ -657,7 +659,7 @@ module AccessPath {
657659
*/
658660
cached
659661
predicate hasDominatingWrite(DataFlow::PropRead read) {
660-
Stages::TypeTracking::ref() and
662+
Stages::DataFlowStage::ref() and
661663
// within the same basic block.
662664
exists(ReachableBasicBlock bb, Root root, string path, int ranking |
663665
read.asExpr() = rankedAccessPath(bb, root, path, ranking, AccessPathRead()) and

javascript/ql/lib/semmle/javascript/frameworks/AngularJS/AngularJSCore.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ private import AngularJS
1515
/**
1616
* Holds if `nd` is a reference to the `angular` variable.
1717
*/
18+
overlay[local]
1819
DataFlow::SourceNode angular() {
1920
// either as a global
2021
result = DataFlow::globalVarRef("angular")

javascript/ql/lib/semmle/javascript/frameworks/LodashUnderscore.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module LodashUnderscore {
99
/**
1010
* A data flow node that accesses a given member of `lodash` or `underscore`.
1111
*/
12+
overlay[local]
1213
abstract class Member extends DataFlow::SourceNode {
1314
/** Gets the name of the accessed member. */
1415
abstract string getName();
@@ -17,6 +18,7 @@ module LodashUnderscore {
1718
/**
1819
* An import of `lodash` or `underscore` accessing a given member of that package.
1920
*/
21+
overlay[local]
2022
private class DefaultMember extends Member {
2123
string name;
2224

@@ -39,12 +41,14 @@ module LodashUnderscore {
3941
* In addition to normal imports, this supports per-method imports such as `require("lodash.map")` and `require("lodash/map")`.
4042
* In addition, the global variable `_` is assumed to refer to `lodash` or `underscore`.
4143
*/
44+
overlay[local]
4245
DataFlow::SourceNode member(string name) { result.(Member).getName() = name }
4346

4447
/**
4548
* Holds if `name` is the name of a member exported from the `lodash` package
4649
* which has a corresponding `lodash.xxx` NPM package.
4750
*/
51+
overlay[local]
4852
private predicate isLodashMember(string name) {
4953
// Can be generated using Object.keys(require('lodash'))
5054
name =

javascript/ql/lib/semmle/javascript/frameworks/PropertyProjection.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Subclass `PropertyProjection` to refine the behavior of the analysis on existing property projections.
55
* Subclass `CustomPropertyProjection` to introduce new kinds of property projections.
66
*/
7+
overlay[local]
8+
module;
79

810
import javascript
911

@@ -137,6 +139,7 @@ private class VarArgsPropertyProjection extends PropertyProjection::Range {
137139
/**
138140
* A taint step for a property projection.
139141
*/
142+
overlay[global]
140143
private class PropertyProjectionTaintStep extends TaintTracking::SharedTaintStep {
141144
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
142145
// reading from a tainted object yields a tainted result

0 commit comments

Comments
 (0)