Skip to content

Commit af1f4c3

Browse files
authored
Merge pull request github#13299 from asgerf/rb/meta-query-summarised-callable-sites
Ruby/Python: add meta-queries for calls to summarised callables
2 parents e046690 + 75fd20b commit af1f4c3

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @name Summarized callable call sites
3+
* @description A call site for which we have a summarized callable
4+
* @kind problem
5+
* @problem.severity recommendation
6+
* @id py/meta/summarized-callable-call-sites
7+
* @tags meta
8+
* @precision very-low
9+
*/
10+
11+
import python
12+
import semmle.python.dataflow.new.DataFlow
13+
import semmle.python.dataflow.new.FlowSummary
14+
import meta.MetaMetrics
15+
16+
from DataFlow::Node useSite, SummarizedCallable target, string kind
17+
where
18+
(
19+
useSite = target.getACall() and kind = "Call"
20+
or
21+
useSite = target.getACallback() and kind = "Callback"
22+
) and
23+
not useSite.getLocation().getFile() instanceof IgnoredFile
24+
select useSite, kind + " to " + target
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @name Summarized callable call sites
3+
* @description A call site for which we have a summarized callable
4+
* @kind problem
5+
* @problem.severity recommendation
6+
* @id rb/meta/summarized-callable-call-sites
7+
* @tags meta
8+
* @precision very-low
9+
*/
10+
11+
import codeql.ruby.AST
12+
import codeql.ruby.dataflow.FlowSummary
13+
14+
from Call invoke, SummarizedCallable f
15+
where f.getACall() = invoke or f.getACallSimple() = invoke
16+
select invoke, "Call to " + f

0 commit comments

Comments
 (0)