mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
Ruby: add asCallable()
This commit is contained in:
@@ -200,6 +200,25 @@ module API {
|
||||
pragma[inline_late]
|
||||
DataFlow::Node asSink() { result = asSinkInline(this) }
|
||||
|
||||
/**
|
||||
* Gets a callable that can reach this sink.
|
||||
*
|
||||
* For example:
|
||||
* ```ruby
|
||||
* Foo.bar do |x| # API::getTopLevelMember("Foo").getMethod("bar").getBlock().asCallable()
|
||||
* end
|
||||
*
|
||||
* class Baz
|
||||
* def m # API::getTopLevelMember("Foo").getMethod("bar").getArgument(0).getMethod("m").asCallable()
|
||||
* end
|
||||
* end
|
||||
* Foo.bar(Baz.new)
|
||||
* ```
|
||||
*/
|
||||
bindingset[this]
|
||||
pragma[inline_late]
|
||||
DataFlow::CallableNode asCallable() { Impl::asCallable(this.getAnEpsilonSuccessor(), result) }
|
||||
|
||||
/**
|
||||
* Get a data-flow node that transitively flows to this value, provided that this value corresponds
|
||||
* to a sink.
|
||||
@@ -1196,6 +1215,11 @@ module API {
|
||||
)
|
||||
}
|
||||
|
||||
cached
|
||||
predicate asCallable(Node apiNode, DataFlow::CallableNode callable) {
|
||||
apiNode = getBackwardStartNode(callable)
|
||||
}
|
||||
|
||||
cached
|
||||
predicate contentEdge(Node pred, DataFlow::Content content, Node succ) {
|
||||
exists(
|
||||
|
||||
Reference in New Issue
Block a user