Skip to content

Commit 7393844

Browse files
committed
JS: Update some queries that used data as source
1 parent 506ddaf commit 7393844

File tree

7 files changed

+11
-21
lines changed

7 files changed

+11
-21
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/CleartextLoggingCustomizations.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module CleartextLogging {
2323
* A data flow sink for clear-text logging of sensitive information.
2424
*/
2525
abstract class Sink extends DataFlow::Node {
26-
DataFlow::FlowLabel getLabel() { result.isDataOrTaint() }
26+
DataFlow::FlowLabel getLabel() { result.isTaint() }
2727
}
2828

2929
/**
@@ -127,7 +127,7 @@ module CleartextLogging {
127127

128128
override string describe() { result = "an access to " + name }
129129

130-
override DataFlow::FlowLabel getLabel() { result.isData() }
130+
override DataFlow::FlowLabel getLabel() { result.isTaint() }
131131
}
132132

133133
/** An access to a variable or property that might contain a password. */
@@ -153,7 +153,7 @@ module CleartextLogging {
153153

154154
override string describe() { result = "an access to " + name }
155155

156-
override DataFlow::FlowLabel getLabel() { result.isData() }
156+
override DataFlow::FlowLabel getLabel() { result.isTaint() }
157157
}
158158

159159
/** A call that might return a password. */
@@ -167,7 +167,7 @@ module CleartextLogging {
167167

168168
override string describe() { result = "a call to " + name }
169169

170-
override DataFlow::FlowLabel getLabel() { result.isData() }
170+
override DataFlow::FlowLabel getLabel() { result.isTaint() }
171171
}
172172

173173
/** An access to the sensitive object `process.env`. */
@@ -177,7 +177,7 @@ module CleartextLogging {
177177
override string describe() { result = "process environment" }
178178

179179
override DataFlow::FlowLabel getLabel() {
180-
result.isData() or
180+
result.isTaint() or
181181
result instanceof PartiallySensitiveMap
182182
}
183183
}

javascript/ql/src/semmle/javascript/security/dataflow/UnsafeDynamicMethodAccess.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module UnsafeDynamicMethodAccess {
5353
hasUnsafeMethods(read.getBase().getALocalSource()) and
5454
src = read.getPropertyNameExpr().flow() and
5555
dst = read and
56-
(srclabel = data() or srclabel = taint()) and
56+
srclabel.isTaint() and
5757
dstlabel = unsafeFunction()
5858
)
5959
or
@@ -62,7 +62,7 @@ module UnsafeDynamicMethodAccess {
6262
not PropertyInjection::isPrototypeLessObject(proj.getObject().getALocalSource()) and
6363
src = proj.getASelector() and
6464
dst = proj and
65-
(srclabel = data() or srclabel = taint()) and
65+
srclabel.isTaint() and
6666
dstlabel = unsafeFunction()
6767
)
6868
}

javascript/ql/src/semmle/javascript/security/dataflow/UnsafeDynamicMethodAccessCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module UnsafeDynamicMethodAccess {
1919
/**
2020
* Gets the flow label relevant for this source.
2121
*/
22-
DataFlow::FlowLabel getFlowLabel() { result = data() }
22+
DataFlow::FlowLabel getFlowLabel() { result = taint() }
2323
}
2424

2525
/**

javascript/ql/src/semmle/javascript/security/dataflow/UnvalidatedDynamicMethodCall.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module UnvalidatedDynamicMethodCall {
4040
exists(DataFlow::PropRead read |
4141
src = read.getPropertyNameExpr().flow() and
4242
dst = read and
43-
(srclabel = data() or srclabel = taint()) and
43+
srclabel.isTaint() and
4444
(
4545
dstlabel instanceof MaybeNonFunction
4646
or

javascript/ql/src/semmle/javascript/security/dataflow/UnvalidatedDynamicMethodCallCustomizations.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ module UnvalidatedDynamicMethodCall {
1919
/**
2020
* Gets the flow label relevant for this source.
2121
*/
22-
DataFlow::FlowLabel getFlowLabel() { result = data() }
22+
DataFlow::FlowLabel getFlowLabel() { result = taint() }
2323
}
24-
24+
2525
/**
2626
* A data flow sink for unvalidated dynamic method calls.
2727
*/

javascript/ql/test/query-tests/Security/CWE-079/ReflectedXss.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ nodes
6565
| promises.js:5:44:5:57 | req.query.data |
6666
| promises.js:5:44:5:57 | req.query.data |
6767
| promises.js:6:11:6:11 | x |
68-
| promises.js:6:11:6:11 | x |
69-
| promises.js:6:25:6:25 | x |
7068
| promises.js:6:25:6:25 | x |
7169
| promises.js:6:25:6:25 | x |
7270
| tst2.js:6:7:6:30 | p |
@@ -148,8 +146,6 @@ edges
148146
| promises.js:5:44:5:57 | req.query.data | promises.js:6:11:6:11 | x |
149147
| promises.js:6:11:6:11 | x | promises.js:6:25:6:25 | x |
150148
| promises.js:6:11:6:11 | x | promises.js:6:25:6:25 | x |
151-
| promises.js:6:11:6:11 | x | promises.js:6:25:6:25 | x |
152-
| promises.js:6:11:6:11 | x | promises.js:6:25:6:25 | x |
153149
| tst2.js:6:7:6:30 | p | tst2.js:7:12:7:12 | p |
154150
| tst2.js:6:7:6:30 | p | tst2.js:7:12:7:12 | p |
155151
| tst2.js:6:7:6:30 | r | tst2.js:8:12:8:12 | r |

javascript/ql/test/query-tests/Security/CWE-312/CleartextLogging.expected

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ nodes
8989
| passwords.js:123:31:123:38 | password |
9090
| passwords.js:123:31:123:48 | password.valueOf() |
9191
| passwords.js:127:9:132:5 | config |
92-
| passwords.js:127:9:132:5 | config |
93-
| passwords.js:127:18:132:5 | {\\n ... )\\n } |
9492
| passwords.js:127:18:132:5 | {\\n ... )\\n } |
9593
| passwords.js:127:18:132:5 | {\\n ... )\\n } |
9694
| passwords.js:130:12:130:19 | password |
@@ -99,7 +97,6 @@ nodes
9997
| passwords.js:131:12:131:24 | getPassword() |
10098
| passwords.js:135:17:135:22 | config |
10199
| passwords.js:135:17:135:22 | config |
102-
| passwords.js:135:17:135:22 | config |
103100
| passwords.js:136:17:136:24 | config.x |
104101
| passwords.js:136:17:136:24 | config.x |
105102
| passwords.js:137:17:137:24 | config.y |
@@ -226,9 +223,6 @@ edges
226223
| passwords.js:123:31:123:48 | password.valueOf() | passwords.js:123:17:123:48 | name + ... lueOf() |
227224
| passwords.js:127:9:132:5 | config | passwords.js:135:17:135:22 | config |
228225
| passwords.js:127:9:132:5 | config | passwords.js:135:17:135:22 | config |
229-
| passwords.js:127:9:132:5 | config | passwords.js:135:17:135:22 | config |
230-
| passwords.js:127:9:132:5 | config | passwords.js:135:17:135:22 | config |
231-
| passwords.js:127:18:132:5 | {\\n ... )\\n } | passwords.js:127:9:132:5 | config |
232226
| passwords.js:127:18:132:5 | {\\n ... )\\n } | passwords.js:127:9:132:5 | config |
233227
| passwords.js:127:18:132:5 | {\\n ... )\\n } | passwords.js:127:9:132:5 | config |
234228
| passwords.js:130:12:130:19 | password | passwords.js:127:18:132:5 | {\\n ... )\\n } |

0 commit comments

Comments
 (0)