-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.ql
More file actions
39 lines (33 loc) · 1.08 KB
/
test.ql
File metadata and controls
39 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import javascript
import utils.test.InlineSummaries
import utils.test.InlineExpectationsTest
private DataFlow::SourceNode typeTrack(DataFlow::TypeTracker t, string name) {
t.start() and
exists(DataFlow::CallNode call |
call.getCalleeName() = "source" and
name = call.getArgument(0).getStringValue() and
result = call
)
or
exists(DataFlow::TypeTracker t2 | result = typeTrack(t2, name).track(t2, t))
}
DataFlow::SourceNode typeTrack(string name) {
result = typeTrack(DataFlow::TypeTracker::end(), name)
}
module TestConfig implements TestSig {
string getARelevantTag() { result = "track" }
predicate hasActualResult(Location location, string element, string tag, string value) {
element = "" and
tag = "track" and
exists(DataFlow::CallNode call, DataFlow::Node arg |
call.getCalleeName() = "sink" and
arg = call.getArgument(0) and
typeTrack(value).flowsTo(arg) and
location = arg.getLocation()
)
}
predicate hasOptionalResult(Location location, string element, string tag, string value) {
none()
}
}
import MakeTest<TestConfig>