Skip to content

Commit 3058198

Browse files
authored
Merge pull request #22078 from geoffw0/rubyinline
Ruby: Address testFailures in inline expectations tests (part 1)
2 parents 2ef06c9 + 46382cb commit 3058198

4 files changed

Lines changed: 15 additions & 22 deletions

File tree

ruby/ql/test/library-tests/dataflow/string-flow/string-flow.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ nodes
2828
| string_flow.rb:227:10:227:10 | a | semmle.label | a |
2929
subpaths
3030
testFailures
31-
| string_flow.rb:85:10:85:10 | a | Unexpected result: hasValueFlow=a |
32-
| string_flow.rb:227:10:227:10 | a | Unexpected result: hasValueFlow=a |
3331
#select
3432
| string_flow.rb:3:10:3:22 | call to new | string_flow.rb:2:9:2:18 | call to source | string_flow.rb:3:10:3:22 | call to new | $@ | string_flow.rb:2:9:2:18 | call to source | call to source |
3533
| string_flow.rb:85:10:85:10 | a | string_flow.rb:83:9:83:18 | call to source | string_flow.rb:85:10:85:10 | a | $@ | string_flow.rb:83:9:83:18 | call to source | call to source |

ruby/ql/test/library-tests/dataflow/string-flow/string_flow.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def m_chomp
8282
def m_clear
8383
a = source "a"
8484
a.clear
85-
sink a
85+
sink a # $ SPURIOUS: hasValueFlow=a
8686
end
8787

8888
# concat and prepend omitted because they clash with the summaries for
@@ -224,7 +224,7 @@ def m_replace
224224
b = source "b"
225225
sink a.replace(b) # $ hasTaintFlow=b
226226
# TODO: currently we get value flow for a, because we don't clear content
227-
sink a # $ hasTaintFlow=b
227+
sink a # $ hasTaintFlow=b SPURIOUS: hasValueFlow=a
228228
end
229229

230230
def m_reverse
@@ -316,4 +316,4 @@ def m_upto(i)
316316
a.upto("b", true) { |x| sink x } # $ hasTaintFlow=a
317317
"b".upto(a) { |x| sink x } # $ hasTaintFlow=a
318318
"b".upto(a, true) { |x| sink x }
319-
end
319+
end

ruby/ql/test/library-tests/frameworks/action_controller/filter_flow.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class OneController < ActionController::Base
1010
before_action :a
1111
after_action :c
12-
12+
1313
def a
1414
@foo = params[:foo]
1515
end
@@ -18,14 +18,14 @@ def b
1818
end
1919

2020
def c
21-
sink @foo
21+
sink @foo # $ hasTaintFlow
2222
end
2323
end
2424

2525
class TwoController < ActionController::Base
2626
before_action :a
2727
after_action :c
28-
28+
2929
def a
3030
@foo = params[:foo]
3131
end
@@ -35,14 +35,14 @@ def b
3535
end
3636

3737
def c
38-
sink @foo
38+
sink @foo # $ SPURIOUS: hasTaintFlow
3939
end
4040
end
4141

4242
class ThreeController < ActionController::Base
4343
before_action :a
4444
after_action :c
45-
45+
4646
def a
4747
@foo = params[:foo]
4848
@foo = "safe"
@@ -52,14 +52,14 @@ def b
5252
end
5353

5454
def c
55-
sink @foo
55+
sink @foo # $ SPURIOUS: hasTaintFlow
5656
end
5757
end
5858

5959
class FourController < ActionController::Base
6060
before_action :a
6161
after_action :c
62-
62+
6363
def a
6464
@foo.bar = params[:foo]
6565
end
@@ -68,14 +68,14 @@ def b
6868
end
6969

7070
def c
71-
sink(@foo.bar)
71+
sink(@foo.bar) # $ hasTaintFlow
7272
end
7373
end
7474

7575
class FiveController < ActionController::Base
7676
before_action :a
7777
after_action :c
78-
78+
7979
def a
8080
self.taint_foo
8181
end
@@ -84,10 +84,10 @@ def b
8484
end
8585

8686
def c
87-
sink @foo
87+
sink @foo # $ hasTaintFlow
8888
end
89-
89+
9090
def taint_foo
9191
@foo = params[:foo]
9292
end
93-
end
93+
end

ruby/ql/test/library-tests/frameworks/action_controller/params-flow.expected

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,6 @@ nodes
270270
| params_flow.rb:205:10:205:10 | a | semmle.label | a |
271271
subpaths
272272
testFailures
273-
| filter_flow.rb:21:10:21:13 | @foo | Unexpected result: hasTaintFlow |
274-
| filter_flow.rb:38:10:38:13 | @foo | Unexpected result: hasTaintFlow |
275-
| filter_flow.rb:55:10:55:13 | @foo | Unexpected result: hasTaintFlow |
276-
| filter_flow.rb:71:10:71:17 | call to bar | Unexpected result: hasTaintFlow |
277-
| filter_flow.rb:87:11:87:14 | @foo | Unexpected result: hasTaintFlow |
278273
#select
279274
| filter_flow.rb:21:10:21:13 | @foo | filter_flow.rb:14:12:14:17 | call to params | filter_flow.rb:21:10:21:13 | @foo | $@ | filter_flow.rb:14:12:14:17 | call to params | call to params |
280275
| filter_flow.rb:38:10:38:13 | @foo | filter_flow.rb:30:12:30:17 | call to params | filter_flow.rb:38:10:38:13 | @foo | $@ | filter_flow.rb:30:12:30:17 | call to params | call to params |

0 commit comments

Comments
 (0)