Skip to content

Commit d82d23a

Browse files
committed
JS: Update TaintTracking test
1 parent e099d78 commit d82d23a

20 files changed

+598
-157
lines changed

javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected

Lines changed: 84 additions & 35 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,60 @@
11
import javascript
22
import semmle.javascript.dataflow.InferredTypes
3+
import testUtilities.ConsistencyChecking
34

45
DataFlow::CallNode getACall(string name) {
56
result.getCalleeName() = name
67
or
78
result.getCalleeNode().getALocalSource() = DataFlow::globalVarRef(name)
89
}
910

10-
class Sink extends DataFlow::Node {
11-
Sink() { this = getACall("sink").getAnArgument() }
12-
}
11+
module TestConfig implements DataFlow::ConfigSig {
12+
predicate isSource(DataFlow::Node node) { node = getACall("source") }
13+
14+
predicate isSink(DataFlow::Node node) { node = getACall("sink").getAnArgument() }
1315

14-
/**
15-
* A node that shouldn't be taintable according to the type inference,
16-
* as it claims to be neither an object nor a string.
17-
*/
18-
class UntaintableNode extends DataFlow::Node {
19-
UntaintableNode() {
20-
not this.analyze().getAType() = TTObject() and
21-
not this.analyze().getAType() = TTString()
16+
predicate isBarrier(DataFlow::Node node) {
17+
node.(DataFlow::InvokeNode).getCalleeName().matches("sanitizer_%") or
18+
node = DataFlow::MakeBarrierGuard<BasicSanitizerGuard>::getABarrierNode() or
19+
node = TaintTracking::AdHocWhitelistCheckSanitizer::getABarrierNode()
2220
}
2321
}
2422

25-
class BasicConfig extends TaintTracking::Configuration {
26-
BasicConfig() { this = "BasicConfig" }
23+
module TestFlow = TaintTracking::Global<TestConfig>;
2724

28-
override predicate isSource(DataFlow::Node node) { node = getACall("source") }
25+
class LegacyConfig extends TaintTracking::Configuration {
26+
LegacyConfig() { this = "LegacyConfig" }
2927

30-
override predicate isSink(DataFlow::Node node) {
31-
node instanceof Sink
32-
or
33-
node instanceof UntaintableNode
34-
}
28+
override predicate isSource(DataFlow::Node node) { TestConfig::isSource(node) }
29+
30+
override predicate isSink(DataFlow::Node node) { TestConfig::isSink(node) }
3531

3632
override predicate isSanitizer(DataFlow::Node node) {
3733
node.(DataFlow::InvokeNode).getCalleeName().matches("sanitizer_%")
3834
}
3935

4036
override predicate isSanitizerGuard(TaintTracking::SanitizerGuardNode node) {
41-
node instanceof BasicSanitizerGuard
37+
node instanceof BasicSanitizerGuard or
38+
node instanceof TaintTracking::AdHocWhitelistCheckSanitizer
4239
}
4340
}
4441

42+
import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
43+
4544
class BasicSanitizerGuard extends TaintTracking::SanitizerGuardNode, DataFlow::CallNode {
4645
BasicSanitizerGuard() { this = getACall("isSafe") }
4746

48-
override predicate sanitizes(boolean outcome, Expr e) {
47+
override predicate sanitizes(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
48+
49+
predicate blocksExpr(boolean outcome, Expr e) {
4950
outcome = true and e = this.getArgument(0).asExpr()
5051
}
5152
}
5253

53-
query predicate typeInferenceMismatch(DataFlow::Node source, UntaintableNode sink) {
54-
any(BasicConfig cfg).hasFlow(source, sink)
55-
}
54+
query predicate flow = TestFlow::flow/2;
5655

57-
from BasicConfig cfg, DataFlow::Node src, Sink sink
58-
where cfg.hasFlow(src, sink)
59-
select src, sink
56+
class Consistency extends ConsistencyConfiguration {
57+
Consistency() { this = "Consistency" }
58+
59+
override DataFlow::Node getAnAlert() { TestFlow::flowTo(result) }
60+
}

javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.expected

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1+
legacyDataFlowDifference
2+
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:38:8:38:13 | arr[5] | only flow with NEW data flow library |
3+
| bound-function.js:27:8:27:15 | source() | bound-function.js:30:10:30:10 | y | only flow with OLD data flow library |
4+
| call-apply.js:27:14:27:21 | source() | call-apply.js:34:6:34:29 | foo1_ap ... e, ""]) | only flow with NEW data flow library |
5+
| call-apply.js:45:8:45:15 | source() | call-apply.js:55:6:55:13 | foo(obj) | only flow with NEW data flow library |
6+
| callbacks.js:37:17:37:24 | source() | callbacks.js:38:35:38:35 | x | only flow with NEW data flow library |
7+
| callbacks.js:37:17:37:24 | source() | callbacks.js:41:10:41:10 | x | only flow with NEW data flow library |
8+
| callbacks.js:44:17:44:24 | source() | callbacks.js:37:37:37:37 | x | only flow with NEW data flow library |
9+
| callbacks.js:44:17:44:24 | source() | callbacks.js:38:35:38:35 | x | only flow with NEW data flow library |
10+
| capture-flow.js:89:13:89:20 | source() | capture-flow.js:89:6:89:21 | test3c(source()) | only flow with NEW data flow library |
11+
| capture-flow.js:101:12:101:19 | source() | capture-flow.js:102:6:102:20 | test5("safe")() | only flow with OLD data flow library |
12+
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:40:8:40:14 | e.taint | only flow with NEW data flow library |
13+
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:44:8:44:19 | f_safe.taint | only flow with NEW data flow library |
14+
| constructor-calls.js:20:15:20:22 | source() | constructor-calls.js:39:8:39:14 | e.param | only flow with NEW data flow library |
15+
| exceptions.js:53:14:53:21 | source() | exceptions.js:54:10:54:10 | e | only flow with NEW data flow library |
16+
| getters-and-setters.js:53:21:53:28 | source() | getters-and-setters.js:53:10:53:30 | getX(ne ... rce())) | only flow with NEW data flow library |
17+
| nested-props.js:14:15:14:22 | source() | nested-props.js:15:10:15:16 | obj.x.y | only flow with NEW data flow library |
18+
| nested-props.js:19:17:19:24 | source() | nested-props.js:20:10:20:18 | obj.x.y.z | only flow with NEW data flow library |
19+
| nested-props.js:27:18:27:25 | source() | nested-props.js:28:10:28:14 | obj.x | only flow with NEW data flow library |
20+
| nested-props.js:51:22:51:29 | source() | nested-props.js:52:10:52:16 | obj.x.y | only flow with NEW data flow library |
21+
| sanitizer-guards.js:57:11:57:18 | source() | sanitizer-guards.js:64:8:64:8 | x | only flow with NEW data flow library |
22+
| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary | only flow with NEW data flow library |
23+
| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary | only flow with NEW data flow library |
24+
flow
125
| access-path-sanitizer.js:2:18:2:25 | source() | access-path-sanitizer.js:4:8:4:12 | obj.x |
226
| advanced-callgraph.js:2:13:2:20 | source() | advanced-callgraph.js:6:22:6:22 | v |
327
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:17:8:17:13 | arr[1] |
428
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:22:8:22:13 | arr[6] |
529
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:28:8:28:13 | arr[1] |
630
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:34:8:34:13 | arr[1] |
31+
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:38:8:38:13 | arr[5] |
732
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:43:10:43:15 | arr[i] |
833
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:55:10:55:15 | arr[i] |
934
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:61:10:61:13 | item |
@@ -13,40 +38,70 @@
1338
| booleanOps.js:2:11:2:18 | source() | booleanOps.js:13:10:13:10 | x |
1439
| booleanOps.js:2:11:2:18 | source() | booleanOps.js:19:10:19:10 | x |
1540
| booleanOps.js:2:11:2:18 | source() | booleanOps.js:22:10:22:10 | x |
16-
| bound-function.js:12:12:12:19 | source() | bound-function.js:4:10:4:10 | y |
17-
| bound-function.js:14:6:14:13 | source() | bound-function.js:4:10:4:10 | y |
18-
| bound-function.js:22:8:22:15 | source() | bound-function.js:25:10:25:10 | y |
19-
| bound-function.js:45:10:45:17 | source() | bound-function.js:45:6:45:18 | id3(source()) |
20-
| bound-function.js:49:12:49:19 | source() | bound-function.js:54:6:54:14 | source0() |
21-
| bound-function.js:49:12:49:19 | source() | bound-function.js:55:6:55:14 | source1() |
41+
| bound-function.js:17:21:17:28 | source() | bound-function.js:5:10:5:16 | y.test2 |
42+
| bound-function.js:19:15:19:22 | source() | bound-function.js:6:10:6:16 | y.test3 |
43+
| bound-function.js:50:10:50:17 | source() | bound-function.js:50:6:50:18 | id3(source()) |
44+
| bound-function.js:54:12:54:19 | source() | bound-function.js:59:6:59:14 | source0() |
45+
| bound-function.js:54:12:54:19 | source() | bound-function.js:60:6:60:14 | source1() |
2246
| call-apply.js:27:14:27:21 | source() | call-apply.js:24:8:24:11 | arg1 |
2347
| call-apply.js:27:14:27:21 | source() | call-apply.js:29:6:29:32 | foo1.ca ... ce, "") |
2448
| call-apply.js:27:14:27:21 | source() | call-apply.js:32:6:32:35 | foo1.ap ... e, ""]) |
25-
| call-apply.js:27:14:27:21 | source() | call-apply.js:46:6:46:28 | foo1_ca ... e, ""]) |
26-
| call-apply.js:27:14:27:21 | source() | call-apply.js:68:10:68:21 | arguments[0] |
27-
| call-apply.js:87:17:87:24 | source() | call-apply.js:84:8:84:11 | this |
49+
| call-apply.js:27:14:27:21 | source() | call-apply.js:34:6:34:29 | foo1_ap ... e, ""]) |
50+
| call-apply.js:27:14:27:21 | source() | call-apply.js:40:6:40:28 | foo1_ca ... e, ""]) |
51+
| call-apply.js:27:14:27:21 | source() | call-apply.js:62:10:62:21 | arguments[0] |
52+
| call-apply.js:45:8:45:15 | source() | call-apply.js:55:6:55:13 | foo(obj) |
53+
| call-apply.js:81:17:81:24 | source() | call-apply.js:78:8:78:11 | this |
2854
| callbacks.js:4:6:4:13 | source() | callbacks.js:34:27:34:27 | x |
2955
| callbacks.js:4:6:4:13 | source() | callbacks.js:35:27:35:27 | x |
3056
| callbacks.js:5:6:5:13 | source() | callbacks.js:34:27:34:27 | x |
3157
| callbacks.js:5:6:5:13 | source() | callbacks.js:35:27:35:27 | x |
3258
| callbacks.js:25:16:25:23 | source() | callbacks.js:47:26:47:26 | x |
3359
| callbacks.js:25:16:25:23 | source() | callbacks.js:48:26:48:26 | x |
3460
| callbacks.js:37:17:37:24 | source() | callbacks.js:37:37:37:37 | x |
61+
| callbacks.js:37:17:37:24 | source() | callbacks.js:38:35:38:35 | x |
62+
| callbacks.js:37:17:37:24 | source() | callbacks.js:41:10:41:10 | x |
63+
| callbacks.js:44:17:44:24 | source() | callbacks.js:37:37:37:37 | x |
64+
| callbacks.js:44:17:44:24 | source() | callbacks.js:38:35:38:35 | x |
3565
| callbacks.js:44:17:44:24 | source() | callbacks.js:41:10:41:10 | x |
3666
| callbacks.js:50:18:50:25 | source() | callbacks.js:30:29:30:29 | y |
3767
| callbacks.js:51:18:51:25 | source() | callbacks.js:30:29:30:29 | y |
3868
| callbacks.js:53:23:53:30 | source() | callbacks.js:58:10:58:10 | x |
3969
| capture-flow.js:9:11:9:18 | source() | capture-flow.js:14:10:14:16 | outer() |
4070
| capture-flow.js:9:11:9:18 | source() | capture-flow.js:19:6:19:16 | outerMost() |
4171
| capture-flow.js:31:14:31:21 | source() | capture-flow.js:31:6:31:22 | confuse(source()) |
72+
| capture-flow.js:45:12:45:19 | source() | capture-flow.js:45:6:45:20 | test3(source()) |
73+
| capture-flow.js:60:13:60:20 | source() | capture-flow.js:60:6:60:21 | test3a(source()) |
74+
| capture-flow.js:76:13:76:20 | source() | capture-flow.js:76:6:76:21 | test3b(source()) |
75+
| capture-flow.js:89:13:89:20 | source() | capture-flow.js:89:6:89:21 | test3c(source()) |
76+
| capture-flow.js:93:13:93:20 | source() | capture-flow.js:96:6:96:14 | test4()() |
77+
| capture-flow.js:101:12:101:19 | source() | capture-flow.js:101:6:101:22 | test5(source())() |
78+
| capture-flow.js:110:12:110:19 | source() | capture-flow.js:106:14:106:14 | x |
79+
| capture-flow.js:118:37:118:44 | source() | capture-flow.js:114:14:114:14 | x |
80+
| capture-flow.js:126:25:126:32 | source() | capture-flow.js:123:14:123:26 | orderingTaint |
81+
| capture-flow.js:126:25:126:32 | source() | capture-flow.js:129:14:129:26 | orderingTaint |
82+
| capture-flow.js:177:26:177:33 | source() | capture-flow.js:173:14:173:14 | x |
83+
| capture-flow.js:187:34:187:41 | source() | capture-flow.js:183:14:183:14 | x |
84+
| capture-flow.js:195:24:195:31 | source() | capture-flow.js:191:14:191:14 | x |
85+
| capture-flow.js:205:24:205:31 | source() | capture-flow.js:200:18:200:18 | x |
86+
| capture-flow.js:225:13:225:20 | source() | capture-flow.js:220:51:220:59 | fileOrDir |
87+
| capture-flow.js:230:9:230:16 | source() | capture-flow.js:233:14:233:14 | x |
88+
| capture-flow.js:259:23:259:30 | source() | capture-flow.js:243:18:243:40 | objectW ... s.field |
89+
| capture-flow.js:259:23:259:30 | source() | capture-flow.js:247:18:247:40 | objectW ... s.field |
90+
| capture-flow.js:259:23:259:30 | source() | capture-flow.js:248:18:248:27 | this.field |
91+
| capture-flow.js:259:23:259:30 | source() | capture-flow.js:252:14:252:36 | objectW ... s.field |
92+
| capture-flow.js:259:23:259:30 | source() | capture-flow.js:253:14:253:23 | this.field |
4293
| captured-sanitizer.js:25:3:25:10 | source() | captured-sanitizer.js:15:10:15:10 | x |
43-
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:18:8:18:14 | c.taint |
44-
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:22:8:22:19 | c_safe.taint |
45-
| constructor-calls.js:10:16:10:23 | source() | constructor-calls.js:26:8:26:14 | d.taint |
46-
| constructor-calls.js:10:16:10:23 | source() | constructor-calls.js:30:8:30:19 | d_safe.taint |
47-
| constructor-calls.js:14:15:14:22 | source() | constructor-calls.js:17:8:17:14 | c.param |
48-
| constructor-calls.js:14:15:14:22 | source() | constructor-calls.js:25:8:25:14 | d.param |
94+
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:24:8:24:14 | c.taint |
95+
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:28:8:28:19 | c_safe.taint |
96+
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:40:8:40:14 | e.taint |
97+
| constructor-calls.js:4:18:4:25 | source() | constructor-calls.js:44:8:44:19 | f_safe.taint |
98+
| constructor-calls.js:10:16:10:23 | source() | constructor-calls.js:32:8:32:14 | d.taint |
99+
| constructor-calls.js:10:16:10:23 | source() | constructor-calls.js:36:8:36:19 | d_safe.taint |
100+
| constructor-calls.js:20:15:20:22 | source() | constructor-calls.js:23:8:23:14 | c.param |
101+
| constructor-calls.js:20:15:20:22 | source() | constructor-calls.js:31:8:31:14 | d.param |
102+
| constructor-calls.js:20:15:20:22 | source() | constructor-calls.js:39:8:39:14 | e.param |
49103
| exceptions.js:3:15:3:22 | source() | exceptions.js:5:10:5:10 | e |
104+
| exceptions.js:53:14:53:21 | source() | exceptions.js:54:10:54:10 | e |
50105
| exceptions.js:59:24:59:31 | source() | exceptions.js:61:12:61:12 | e |
51106
| exceptions.js:88:6:88:13 | source() | exceptions.js:11:10:11:10 | e |
52107
| exceptions.js:93:11:93:18 | source() | exceptions.js:95:10:95:10 | e |
@@ -64,18 +119,24 @@
64119
| getters-and-setters.js:6:20:6:27 | source() | getters-and-setters.js:13:18:13:20 | c.x |
65120
| getters-and-setters.js:27:15:27:22 | source() | getters-and-setters.js:23:18:23:18 | v |
66121
| getters-and-setters.js:47:23:47:30 | source() | getters-and-setters.js:45:14:45:16 | c.x |
122+
| getters-and-setters.js:53:21:53:28 | source() | getters-and-setters.js:53:10:53:30 | getX(ne ... rce())) |
67123
| getters-and-setters.js:60:20:60:27 | source() | getters-and-setters.js:66:10:66:14 | obj.x |
68124
| getters-and-setters.js:67:13:67:20 | source() | getters-and-setters.js:63:18:63:22 | value |
69125
| getters-and-setters.js:79:20:79:27 | source() | getters-and-setters.js:88:10:88:18 | new C().x |
70126
| getters-and-setters.js:79:20:79:27 | source() | getters-and-setters.js:92:14:92:16 | c.x |
71127
| getters-and-setters.js:79:20:79:27 | source() | getters-and-setters.js:100:10:100:22 | getX(new C()) |
72128
| getters-and-setters.js:89:17:89:24 | source() | getters-and-setters.js:82:18:82:22 | value |
129+
| implied-receiver.js:4:16:4:23 | source() | implied-receiver.js:7:18:7:25 | this.foo |
73130
| indexOf.js:4:11:4:18 | source() | indexOf.js:9:10:9:10 | x |
74131
| indexOf.js:4:11:4:18 | source() | indexOf.js:13:10:13:10 | x |
75132
| nested-props.js:4:13:4:20 | source() | nested-props.js:5:10:5:14 | obj.x |
76133
| nested-props.js:9:18:9:25 | source() | nested-props.js:10:10:10:16 | obj.x.y |
134+
| nested-props.js:14:15:14:22 | source() | nested-props.js:15:10:15:16 | obj.x.y |
135+
| nested-props.js:19:17:19:24 | source() | nested-props.js:20:10:20:18 | obj.x.y.z |
136+
| nested-props.js:27:18:27:25 | source() | nested-props.js:28:10:28:14 | obj.x |
77137
| nested-props.js:35:13:35:20 | source() | nested-props.js:36:10:36:20 | doLoad(obj) |
78138
| nested-props.js:43:13:43:20 | source() | nested-props.js:44:10:44:18 | id(obj).x |
139+
| nested-props.js:51:22:51:29 | source() | nested-props.js:52:10:52:16 | obj.x.y |
79140
| nested-props.js:67:31:67:38 | source() | nested-props.js:68:10:68:10 | x |
80141
| object-bypass-sanitizer.js:32:21:32:28 | source() | object-bypass-sanitizer.js:15:10:15:24 | sanitizer_id(x) |
81142
| object-bypass-sanitizer.js:35:29:35:36 | source() | object-bypass-sanitizer.js:27:10:27:30 | sanitiz ... bj.foo) |
@@ -97,10 +158,11 @@
97158
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:45:8:45:8 | x |
98159
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:48:10:48:10 | x |
99160
| sanitizer-guards.js:43:11:43:18 | source() | sanitizer-guards.js:52:10:52:10 | x |
161+
| sanitizer-guards.js:57:11:57:18 | source() | sanitizer-guards.js:64:8:64:8 | x |
100162
| sanitizer-guards.js:68:11:68:18 | source() | sanitizer-guards.js:75:8:75:8 | x |
101163
| sanitizer-guards.js:79:11:79:18 | source() | sanitizer-guards.js:81:8:81:8 | x |
102164
| sanitizer-guards.js:79:11:79:18 | source() | sanitizer-guards.js:84:10:84:10 | x |
103-
| sanitizer-guards.js:79:11:79:18 | source() | sanitizer-guards.js:86:7:86:7 | x |
165+
| sanitizer-guards.js:79:11:79:18 | source() | sanitizer-guards.js:86:9:86:9 | x |
104166
| sanitizer-guards.js:91:11:91:18 | source() | sanitizer-guards.js:93:8:93:8 | x |
105167
| sanitizer-guards.js:91:11:91:18 | source() | sanitizer-guards.js:96:10:96:10 | x |
106168
| sanitizer-guards.js:91:11:91:18 | source() | sanitizer-guards.js:98:7:98:7 | x |
@@ -109,3 +171,5 @@
109171
| thisAssignments.js:4:17:4:24 | source() | thisAssignments.js:5:10:5:18 | obj.field |
110172
| thisAssignments.js:7:19:7:26 | source() | thisAssignments.js:8:10:8:20 | this.field2 |
111173
| tst.js:2:13:2:20 | source() | tst.js:4:10:4:10 | x |
174+
| tst.js:2:13:2:20 | source() | tst.js:35:14:35:16 | ary |
175+
| tst.js:2:13:2:20 | source() | tst.js:41:14:41:16 | ary |

javascript/ql/test/library-tests/TaintTracking/DataFlowTracking.ql

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,44 @@ import javascript
22

33
DataFlow::CallNode getACall(string name) { result.getCalleeName() = name }
44

5-
class BasicConfig extends DataFlow::Configuration {
6-
BasicConfig() { this = "BasicConfig" }
5+
module TestConfig implements DataFlow::ConfigSig {
6+
predicate isSource(DataFlow::Node node) { node = getACall("source") }
77

8-
override predicate isSource(DataFlow::Node node) { node = getACall("source") }
8+
predicate isSink(DataFlow::Node node) { node = getACall("sink").getAnArgument() }
99

10-
override predicate isSink(DataFlow::Node node) { node = getACall("sink").getAnArgument() }
11-
12-
override predicate isBarrierGuard(DataFlow::BarrierGuardNode node) {
10+
additional predicate isBarrierGuard(DataFlow::BarrierGuardNode node) {
1311
node instanceof BasicBarrierGuard
1412
}
13+
14+
predicate isBarrier(DataFlow::Node node) {
15+
node = DataFlow::MakeLegacyBarrierGuard<isBarrierGuard/1>::getABarrierNode()
16+
}
1517
}
1618

19+
module TestFlow = DataFlow::Global<TestConfig>;
20+
1721
class BasicBarrierGuard extends DataFlow::BarrierGuardNode, DataFlow::CallNode {
1822
BasicBarrierGuard() { this = getACall("isSafe") }
1923

20-
override predicate blocks(boolean outcome, Expr e) {
24+
override predicate blocks(boolean outcome, Expr e) { this.blocksExpr(outcome, e) }
25+
26+
predicate blocksExpr(boolean outcome, Expr e) {
2127
outcome = true and e = this.getArgument(0).asExpr()
2228
}
2329
}
2430

25-
from BasicConfig cfg, DataFlow::Node src, DataFlow::Node sink
26-
where cfg.hasFlow(src, sink)
27-
select src, sink
31+
class LegacyConfig extends DataFlow::Configuration {
32+
LegacyConfig() { this = "LegacyConfig" }
33+
34+
override predicate isSource(DataFlow::Node source) { TestConfig::isSource(source) }
35+
36+
override predicate isSink(DataFlow::Node sink) { TestConfig::isSink(sink) }
37+
38+
override predicate isBarrierGuard(DataFlow::BarrierGuardNode node) {
39+
TestConfig::isBarrierGuard(node)
40+
}
41+
}
42+
43+
import testUtilities.LegacyDataFlowDiff::DataFlowDiff<TestFlow, LegacyConfig>
44+
45+
query predicate flow = TestFlow::flow/2;

0 commit comments

Comments
 (0)