Skip to content

Commit 8e2ffc2

Browse files
committed
Ruby: add the inline test expectations
1 parent 5703f63 commit 8e2ffc2

File tree

2 files changed

+22
-43
lines changed

2 files changed

+22
-43
lines changed

ruby/ql/test/library-tests/dataflow/summaries/Summaries.expected

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,4 @@
11
failures
2-
| summaries.rb:2:6:2:12 | tainted | Unexpected result: hasValueFlow=tainted |
3-
| summaries.rb:5:8:5:8 | x | Unexpected result: hasValueFlow=tainted |
4-
| summaries.rb:9:6:9:13 | tainted2 | Unexpected result: hasValueFlow=tainted |
5-
| summaries.rb:12:8:12:8 | x | Unexpected result: hasValueFlow=tainted |
6-
| summaries.rb:18:6:18:13 | tainted3 | Unexpected result: hasValueFlow=tainted |
7-
| summaries.rb:21:6:21:13 | tainted4 | Unexpected result: hasTaintFlow=tainted |
8-
| summaries.rb:27:6:27:13 | tainted5 | Unexpected result: hasTaintFlow=tainted |
9-
| summaries.rb:30:6:30:42 | call to onlyWithBlock | Unexpected result: hasTaintFlow=tainted |
10-
| summaries.rb:31:6:31:34 | call to onlyWithoutBlock | Unexpected result: hasTaintFlow=tainted |
11-
| summaries.rb:34:16:34:22 | tainted | Unexpected result: hasValueFlow=tainted |
12-
| summaries.rb:35:16:35:22 | tainted | Unexpected result: hasValueFlow=tainted |
13-
| summaries.rb:36:21:36:27 | tainted | Unexpected result: hasValueFlow=tainted |
14-
| summaries.rb:37:36:37:42 | tainted | Unexpected result: hasValueFlow=tainted |
15-
| summaries.rb:41:8:41:25 | call to matchedByName | Unexpected result: hasTaintFlow=t |
16-
| summaries.rb:42:8:42:25 | call to matchedByName | Unexpected result: hasTaintFlow=t |
17-
| summaries.rb:44:8:44:27 | call to matchedByNameRcv | Unexpected result: hasTaintFlow=t |
18-
| summaries.rb:48:8:48:42 | call to preserveTaint | Unexpected result: hasTaintFlow=blockArg |
19-
| summaries.rb:51:6:51:31 | call to namedArg | Unexpected result: hasTaintFlow=tainted |
20-
| summaries.rb:55:8:55:8 | x | Unexpected result: hasTaintFlow=tainted |
21-
| summaries.rb:62:8:62:54 | call to preserveTaint | Unexpected result: hasTaintFlow=startInNamedCallback |
22-
| summaries.rb:65:8:65:57 | call to preserveTaint | Unexpected result: hasTaintFlow=startInNamedParameter |
232
invalidSpecComponent
243
invalidOutputSpecComponent
254
warning
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
11
tainted = identity source("tainted")
2-
sink tainted
2+
sink tainted # $ hasValueFlow=tainted
33

44
tainted2 = apply_block tainted do |x|
5-
sink x
5+
sink x # $ hasValueFlow=tainted
66
x
77
end
88

9-
sink tainted2
9+
sink tainted2 # $ hasValueFlow=tainted
1010

1111
my_lambda = -> (x) {
12-
sink x
12+
sink x # $ hasValueFlow=tainted
1313
x
1414
}
1515

1616
tainted3 = apply_lambda(my_lambda, tainted)
1717

18-
sink(tainted3)
18+
sink(tainted3) # $ hasValueFlow=tainted
1919

2020
tainted4 = Foo.firstArg(tainted)
21-
sink(tainted4)
21+
sink(tainted4) # $ hasTaintFlow=tainted
2222

2323
notTainted = Foo.firstArg(nil, tainted))
2424
sink(notTainted)
2525

2626
tainted5 = Foo.secondArg(nil, tainted)
27-
sink(tainted5)
27+
sink(tainted5) # $ hasTaintFlow=tainted
2828

2929
sink(Foo.onlyWithBlock(tainted))
30-
sink(Foo.onlyWithBlock(tainted) do |x| end)
31-
sink(Foo.onlyWithoutBlock(tainted))
30+
sink(Foo.onlyWithBlock(tainted) do |x| end) # $ hasTaintFlow=tainted
31+
sink(Foo.onlyWithoutBlock(tainted)) # $ hasTaintFlow=tainted
3232
sink(Foo.onlyWithoutBlock(tainted) do |x| end)
3333

34-
Foo.new.method(tainted)
35-
Bar.new.method(tainted)
36-
Bar.new.next.method(tainted)
37-
Bar.new.next.next.next.next.method(tainted)
34+
Foo.new.method(tainted) # $ hasValueFlow=tainted
35+
Bar.new.method(tainted) # $ hasValueFlow=tainted
36+
Bar.new.next.method(tainted) # $ hasValueFlow=tainted
37+
Bar.new.next.next.next.next.method(tainted) # $ hasValueFlow=tainted
3838

3939
def userDefinedFunction(x, y)
4040
t = source("t")
41-
sink(x.matchedByName(t))
42-
sink(y.matchedByName(t))
41+
sink(x.matchedByName(t)) # $ hasTaintFlow=t
42+
sink(y.matchedByName(t)) # $ hasTaintFlow=t
4343
sink(x.unmatchedName(t))
44-
sink(t.matchedByNameRcv())
44+
sink(t.matchedByNameRcv()) # $ hasTaintFlow=t
4545
end
4646

4747
Foo.blockArg do |x|
48-
sink(x.preserveTaint(source("blockArg")))
48+
sink(x.preserveTaint(source("blockArg"))) # $ hasTaintFlow=blockArg
4949
end
5050

51-
sink(Foo.namedArg(foo: tainted))
51+
sink(Foo.namedArg(foo: tainted)) # $ hasTaintFlow=tainted
5252
sink(Foo.namedArg(tainted))
5353

5454
Foo.intoNamedCallback(tainted, foo: ->(x) {
55-
sink(x)
55+
sink(x) # $ hasTaintFlow=tainted
5656
})
5757
Foo.intoNamedParameter(tainted, ->(foo:) {
58-
sink(foo)
58+
sink(foo) # $ MISSING: hasTaintFlow=tainted
5959
})
6060

6161
Foo.startInNamedCallback(foo: ->(x) {
62-
sink(x.preserveTaint(source("startInNamedCallback")))
62+
sink(x.preserveTaint(source("startInNamedCallback"))) # $ hasTaintFlow=startInNamedCallback
6363
})
6464
Foo.startInNamedParameter(->(foo:) {
65-
sink(foo.preserveTaint(source("startInNamedParameter")))
65+
sink(foo.preserveTaint(source("startInNamedParameter"))) # $ hasTaintFlow=startInNamedParameter
6666
})

0 commit comments

Comments
 (0)