mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
Add test for erb flow
This commit is contained in:
committed by
Tom Hvitved
parent
2d95ac9d5f
commit
bf3b86b402
5
ruby/ql/test/library-tests/dataflow/erb/erb.expected
Normal file
5
ruby/ql/test/library-tests/dataflow/erb/erb.expected
Normal file
@@ -0,0 +1,5 @@
|
||||
testFailures
|
||||
edges
|
||||
nodes
|
||||
subpaths
|
||||
#select
|
||||
13
ruby/ql/test/library-tests/dataflow/erb/erb.ql
Normal file
13
ruby/ql/test/library-tests/dataflow/erb/erb.ql
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @kind path-problem
|
||||
*/
|
||||
|
||||
import codeql.ruby.AST
|
||||
import codeql.ruby.CFG
|
||||
import TestUtilities.InlineFlowTest
|
||||
import ValueFlowTest<DefaultFlowConfig>
|
||||
import ValueFlow::PathGraph
|
||||
|
||||
from ValueFlow::PathNode source, ValueFlow::PathNode sink
|
||||
where ValueFlow::flowPath(source, sink)
|
||||
select sink, source, sink, "$@", source, source.toString()
|
||||
7
ruby/ql/test/library-tests/dataflow/erb/main.rb
Normal file
7
ruby/ql/test/library-tests/dataflow/erb/main.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class App
|
||||
def run
|
||||
x = source(1)
|
||||
view = View.new(x)
|
||||
render(view)
|
||||
end
|
||||
end
|
||||
1
ruby/ql/test/library-tests/dataflow/erb/view.erb
Normal file
1
ruby/ql/test/library-tests/dataflow/erb/view.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= foo() %>
|
||||
9
ruby/ql/test/library-tests/dataflow/erb/view.rb
Normal file
9
ruby/ql/test/library-tests/dataflow/erb/view.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class View
|
||||
def initialize(x)
|
||||
@x = x
|
||||
end
|
||||
|
||||
def foo
|
||||
sink(@x) # $ hasValueFlow=1
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user