Skip to content

Commit f6ac63b

Browse files
committed
Ruby: modgen - use FeatureEqualSourceSinkCallContext feature rather than late filtering for method context
1 parent 0818354 commit f6ac63b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ module Summaries {
1919
}
2020

2121
predicate isSink(DataFlow::Node sink) { sink = any(DataFlow::MethodNode m).getAReturnNode() }
22+
23+
DataFlow::FlowFeature getAFeature() {
24+
result instanceof DataFlow::FeatureEqualSourceSinkCallContext
25+
}
2226
}
2327

2428
private module ValueFlow {
2529
import DataFlow::Global<Config>
2630

2731
predicate summaryModel(string type, string path, string input, string output) {
28-
exists(DataFlow::MethodNode methodNode, API::Node paramNode |
32+
exists(DataFlow::MethodNode methodNode, DataFlow::ParameterNode paramNode |
2933
methodNode.getLocation().getFile() instanceof Util::RelevantFile and
30-
flow(paramNode.asSource(), methodNode.getAReturnNode()) and
31-
paramNode.asSource() = Util::getAnyParameter(methodNode)
34+
flow(paramNode, methodNode.getAReturnNode())
3235
|
3336
Util::pathToMethod(methodNode, type, path) and
34-
input = Util::getArgumentPath(paramNode.asSource()) and
37+
input = Util::getArgumentPath(paramNode) and
3538
output = "ReturnValue"
3639
)
3740
}
@@ -42,13 +45,12 @@ module Summaries {
4245

4346
predicate summaryModel(string type, string path, string input, string output) {
4447
not ValueFlow::summaryModel(type, path, input, output) and
45-
exists(DataFlow::MethodNode methodNode, API::Node paramNode |
48+
exists(DataFlow::MethodNode methodNode, DataFlow::ParameterNode paramNode |
4649
methodNode.getLocation().getFile() instanceof Util::RelevantFile and
47-
flow(paramNode.asSource(), methodNode.getAReturnNode()) and
48-
paramNode.asSource() = Util::getAnyParameter(methodNode)
50+
flow(paramNode, methodNode.getAReturnNode())
4951
|
5052
Util::pathToMethod(methodNode, type, path) and
51-
input = Util::getArgumentPath(paramNode.asSource()) and
53+
input = Util::getArgumentPath(paramNode) and
5254
output = "ReturnValue"
5355
)
5456
}

0 commit comments

Comments
 (0)