[Java] taint query find weird step when calling super #16973
-
Hi, I'm trying to follow the value parameter in this It goes well until the Until here where it goes in a random function calling I have the following predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(GetterTaintStep s).step(node1, node2) or
} Which contains the following piece of code: class GetterTaintStep extends GadgetAdditionalTaintStep {
override predicate step(DataFlow::Node fromNode, DataFlow::Node toNode) {
exists(MethodCall ma, Method m |
ma.getMethod() = m and
m.getName().matches("get%") and
m.getNumberOfParameters() = 0 and
fromNode.asExpr() = ma.getQualifier() and
toNode.asExpr() = ma
)
}
} If I remove my |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
The flow seems to somehow jump from one instance of HashMap (the I see there is a trailing In cases like this I'd use the "quick eval" feature of the VScode plugin on the |
Beta Was this translation helpful? Give feedback.
-
If |
Beta Was this translation helpful? Give feedback.
That depends on what you're actually trying to achieve. What you currently have is a source definition that looks somewhat weird to me - starting from the value parameter in a map.put method seems odd. But if what you want is to e.g. start from some set of parameters in general and see where flow goes without returning, such that the path is applicable in any call context, then you have the option of using
DataFlow::FlowFeature getAFeature() { result instanceof DataFlow::FeatureHasSourceCallContext }
in your configuration, since that will instruct the library to never follow return-edges from the callable containing the source.