Skip to content

Commit 24946c0

Browse files
committed
Ruby: modgen - restrict flow summaries to public methods
1 parent fef2932 commit 24946c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ruby/ql/src/queries/modeling/internal/Summaries.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ private import Util as Util
1212
*/
1313
module Summaries {
1414
private module Config implements DataFlow::ConfigSig {
15-
predicate isSource(DataFlow::Node source) { source instanceof DataFlow::ParameterNode }
15+
predicate isSource(DataFlow::Node source) {
16+
exists(DataFlow::MethodNode methodNode | not methodNode.isPublic() |
17+
getAnyParameterNode(methodNode).asSource() = source
18+
)
19+
}
1620

1721
predicate isSink(DataFlow::Node sink) { sink = any(DataFlow::MethodNode m).getAReturnNode() }
1822
}
1923

20-
API::Node getAnyParameterNode(DataFlow::MethodNode methodNode) {
24+
private API::Node getAnyParameterNode(DataFlow::MethodNode methodNode) {
2125
result.asSource() =
2226
[
2327
methodNode.getParameter(_), methodNode.getKeywordParameter(_),

0 commit comments

Comments
 (0)