Skip to content

Commit d58fe8e

Browse files
committed
add explicit this
1 parent d1ad08e commit d58fe8e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module TaintTracking {
8787
override predicate isLabeledBarrier(DataFlow::Node node, DataFlow::FlowLabel lbl) {
8888
super.isLabeledBarrier(node, lbl)
8989
or
90-
isSanitizer(node) and lbl.isTaint()
90+
this.isSanitizer(node) and lbl.isTaint()
9191
}
9292

9393
override predicate isBarrier(DataFlow::Node node) {
@@ -103,15 +103,15 @@ module TaintTracking {
103103
) {
104104
super.isBarrierEdge(source, sink, lbl)
105105
or
106-
isSanitizerEdge(source, sink, lbl)
106+
this.isSanitizerEdge(source, sink, lbl)
107107
or
108-
isSanitizerEdge(source, sink) and lbl.isTaint()
108+
this.isSanitizerEdge(source, sink) and lbl.isTaint()
109109
}
110110

111111
final override predicate isBarrierGuard(DataFlow::BarrierGuardNode guard) {
112112
super.isBarrierGuard(guard) or
113113
guard.(AdditionalSanitizerGuardNode).appliesTo(this) or
114-
isSanitizerGuard(guard)
114+
this.isSanitizerGuard(guard)
115115
}
116116

117117
/**
@@ -121,14 +121,14 @@ module TaintTracking {
121121
predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) { none() }
122122

123123
final override predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
124-
isAdditionalTaintStep(pred, succ) or
124+
this.isAdditionalTaintStep(pred, succ) or
125125
sharedTaintStep(pred, succ)
126126
}
127127

128128
final override predicate isAdditionalFlowStep(
129129
DataFlow::Node pred, DataFlow::Node succ, boolean valuePreserving
130130
) {
131-
isAdditionalFlowStep(pred, succ) and valuePreserving = false
131+
this.isAdditionalFlowStep(pred, succ) and valuePreserving = false
132132
}
133133

134134
override DataFlow::FlowLabel getDefaultSourceLabel() { result.isTaint() }
@@ -173,9 +173,9 @@ module TaintTracking {
173173
abstract predicate sanitizes(boolean outcome, Expr e);
174174

175175
override predicate blocks(boolean outcome, Expr e, DataFlow::FlowLabel label) {
176-
sanitizes(outcome, e) and label.isTaint()
176+
this.sanitizes(outcome, e) and label.isTaint()
177177
or
178-
sanitizes(outcome, e, label)
178+
this.sanitizes(outcome, e, label)
179179
}
180180

181181
/**
@@ -1032,13 +1032,13 @@ module TaintTracking {
10321032
name = "has" or
10331033
name = "hasOwnProperty"
10341034
|
1035-
getMethodName() = name
1035+
this.getMethodName() = name
10361036
)
10371037
}
10381038

10391039
override predicate sanitizes(boolean outcome, Expr e) {
10401040
outcome = true and
1041-
e = getArgument(0).asExpr()
1041+
e = this.getArgument(0).asExpr()
10421042
}
10431043

10441044
override predicate appliesTo(Configuration cfg) { any() }
@@ -1053,14 +1053,14 @@ module TaintTracking {
10531053
*/
10541054
class AdHocWhitelistCheckSanitizer extends SanitizerGuardNode, DataFlow::CallNode {
10551055
AdHocWhitelistCheckSanitizer() {
1056-
getCalleeName()
1056+
this.getCalleeName()
10571057
.regexpMatch("(?i).*((?<!un)safe|whitelist|(?<!in)valid|allow|(?<!un)auth(?!or\\b)).*") and
1058-
getNumArgument() = 1
1058+
this.getNumArgument() = 1
10591059
}
10601060

10611061
override predicate sanitizes(boolean outcome, Expr e) {
10621062
outcome = true and
1063-
e = getArgument(0).asExpr()
1063+
e = this.getArgument(0).asExpr()
10641064
}
10651065
}
10661066

javascript/ql/src/Security/CWE-020/IncompleteUrlSchemeCheck.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DangerousScheme extends string {
2424
string getWithoutColon() { this = result + ":" }
2525

2626
/** Gets the name of this scheme, with or without the `:`. */
27-
string getWithOrWithoutColon() { result = this or result = getWithoutColon() }
27+
string getWithOrWithoutColon() { result = this or result = this.getWithoutColon() }
2828
}
2929

3030
/** Returns a node that refers to the scheme of `url`. */

javascript/ql/test/ApiGraphs/VerifyAssertions.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class Assertion extends Comment {
8484
string tryExplainFailure() {
8585
exists(int i, API::Node nd, string prefix, string suffix |
8686
nd = this.lookup(i) and
87-
i < getPathLength() and
88-
not exists(this.lookup([i + 1 .. getPathLength()])) and
87+
i < this.getPathLength() and
88+
not exists(this.lookup([i + 1 .. this.getPathLength()])) and
8989
prefix = nd + " has no outgoing edge labelled " + this.getEdgeLabel(i) + ";" and
9090
if exists(nd.getASuccessor())
9191
then

javascript/ql/test/library-tests/CallGraphs/AnnotatedTest/Test.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ class AnnotatedCall extends DataFlow::Node {
4242
string getCallTargetName() { result = calls }
4343

4444
AnnotatedFunction getAnExpectedCallee(string kind_) {
45-
result.getCalleeName() = getCallTargetName() and
45+
result.getCalleeName() = this.getCallTargetName() and
4646
kind = kind_
4747
}
4848

4949
int getBoundArgs() { result = getAnnotation(this.getAstNode(), "boundArgs").toInt() }
5050

5151
int getBoundArgsOrMinusOne() {
52-
result = getBoundArgs()
52+
result = this.getBoundArgs()
5353
or
54-
not exists(getBoundArgs()) and
54+
not exists(this.getBoundArgs()) and
5555
result = -1
5656
}
5757

0 commit comments

Comments
 (0)