mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Add more tests
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:3:9:3:9 | x |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:3:9:3:21 | ... = ... |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:9:4:12 | view [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:9:4:26 | ... = ... [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:16:4:26 | call to new [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:16:4:26 | synthetic splat argument [splat position 0] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:25:4:25 | x |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:9:4:27 | ... = ... [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:16:4:27 | call to new [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:16:4:27 | synthetic splat argument [splat position 0] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:4:26:4:26 | x |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:5:9:5:20 | synthetic splat argument [splat position 0, ... (2)] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:5:16:5:19 | view [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | main.rb:5:16:5:19 | view [Ext] [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | view.rb:2:5:4:7 | synthetic splat parameter [splat position 0] |
|
||||
| main.rb:3:13:3:21 | call to source | view.rb:2:20:2:20 | x |
|
||||
| main.rb:3:13:3:21 | call to source | view.rb:2:20:2:20 | x |
|
||||
| main.rb:3:13:3:21 | call to source | view.rb:3:9:3:10 | [post] self [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | view.rb:3:9:3:14 | ... = ... |
|
||||
| main.rb:3:13:3:21 | call to source | view.rb:3:14:3:14 | x |
|
||||
| main.rb:3:13:3:21 | call to source | view1.rb:5:5:7:7 | synthetic splat parameter [splat position 0] |
|
||||
| main.rb:3:13:3:21 | call to source | view1.rb:5:20:5:20 | x |
|
||||
| main.rb:3:13:3:21 | call to source | view1.rb:5:20:5:20 | x |
|
||||
| main.rb:3:13:3:21 | call to source | view1.rb:6:9:6:10 | [post] self [@x] |
|
||||
| main.rb:3:13:3:21 | call to source | view1.rb:6:9:6:14 | ... = ... |
|
||||
| main.rb:3:13:3:21 | call to source | view1.rb:6:14:6:14 | x |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:15:9:15:9 | x |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:15:9:15:21 | ... = ... |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:16:9:16:12 | view [@x] |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:16:9:16:27 | ... = ... [@x] |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:16:16:16:27 | call to new [@x] |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:16:16:16:27 | synthetic splat argument [splat position 0] |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:16:26:16:26 | x |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:17:9:17:20 | synthetic splat argument [splat position 0, ... (2)] |
|
||||
| main.rb:15:13:15:21 | call to source | main.rb:17:16:17:19 | view [@x] |
|
||||
| main.rb:15:13:15:21 | call to source | view3.rb:2:5:4:7 | synthetic splat parameter [splat position 0] |
|
||||
| main.rb:15:13:15:21 | call to source | view3.rb:2:20:2:20 | x |
|
||||
| main.rb:15:13:15:21 | call to source | view3.rb:2:20:2:20 | x |
|
||||
| main.rb:15:13:15:21 | call to source | view3.rb:3:9:3:10 | [post] self [@x] |
|
||||
| main.rb:15:13:15:21 | call to source | view3.rb:3:9:3:14 | ... = ... |
|
||||
| main.rb:15:13:15:21 | call to source | view3.rb:3:14:3:14 | x |
|
||||
| view1.html.erb:6:5:6:13 | call to source | view1.html.erb:6:1:6:14 | synthetic splat argument [splat position 0] |
|
||||
| view2.html.erb:3:5:3:13 | call to source | view2.html.erb:3:1:3:14 | synthetic splat argument [splat position 0] |
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
class App
|
||||
def run
|
||||
def run1
|
||||
x = source(1)
|
||||
view = View.new(x)
|
||||
view = View1.new(x)
|
||||
render(view)
|
||||
end
|
||||
end
|
||||
|
||||
def run2
|
||||
view = View2.new
|
||||
render(view)
|
||||
view.foo
|
||||
end
|
||||
|
||||
def run3
|
||||
x = source(4)
|
||||
view = View3.new(x)
|
||||
render(view)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<%= foo() %>
|
||||
@@ -1,9 +0,0 @@
|
||||
class View
|
||||
def initialize(x)
|
||||
@x = x
|
||||
end
|
||||
|
||||
def foo
|
||||
sink(@x) # $ hasValueFlow=1
|
||||
end
|
||||
end
|
||||
8
ruby/ql/test/library-tests/dataflow/erb/view1.html.erb
Normal file
8
ruby/ql/test/library-tests/dataflow/erb/view1.html.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
<%# Flow through an ERB template %>
|
||||
<%= foo() %>
|
||||
|
||||
<%# Flow out of an ERB template %>
|
||||
<%
|
||||
set(source(2))
|
||||
foo()
|
||||
%>
|
||||
16
ruby/ql/test/library-tests/dataflow/erb/view1.rb
Normal file
16
ruby/ql/test/library-tests/dataflow/erb/view1.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class ViewComponent::Base
|
||||
end
|
||||
|
||||
class View1 < ViewComponent::Base
|
||||
def initialize(x)
|
||||
@x = x
|
||||
end
|
||||
|
||||
def foo
|
||||
sink(@x) # $ hasValueFlow=1 $ hasValueFlow=2
|
||||
end
|
||||
|
||||
def set(x)
|
||||
@x = x
|
||||
end
|
||||
end
|
||||
4
ruby/ql/test/library-tests/dataflow/erb/view2.html.erb
Normal file
4
ruby/ql/test/library-tests/dataflow/erb/view2.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<%# Flow out of an ERB template (side-effect) %>
|
||||
<%
|
||||
set(source(3))
|
||||
%>
|
||||
9
ruby/ql/test/library-tests/dataflow/erb/view2.rb
Normal file
9
ruby/ql/test/library-tests/dataflow/erb/view2.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class View2 < ViewComponent::Base
|
||||
def foo
|
||||
sink(@x) # $ hasValueFlow=3
|
||||
end
|
||||
|
||||
def set(x)
|
||||
@x = x
|
||||
end
|
||||
end
|
||||
4
ruby/ql/test/library-tests/dataflow/erb/view3.html.erb
Normal file
4
ruby/ql/test/library-tests/dataflow/erb/view3.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<%# Flow into an ERB template %>
|
||||
<%
|
||||
sink(get) # $ hasValueFlow=4
|
||||
%>
|
||||
9
ruby/ql/test/library-tests/dataflow/erb/view3.rb
Normal file
9
ruby/ql/test/library-tests/dataflow/erb/view3.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class View3 < ViewComponent::Base
|
||||
def initialize(x)
|
||||
@x = x
|
||||
end
|
||||
|
||||
def get
|
||||
@x
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user