Codeql To detect log injection of sensitive data doesn't catch implicit toString() call #13065
-
Hi, Bases on this query https://codeql.github.com/codeql-query-help/java/java-sensitive-log/ I have written a query that considers My problem is that an implicit call to toString() , which leaks secret data is not captured by this query, eg. :
which is the exact same isn't caught... Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @yuval-piiano. How have you defined the sources, sinks and additional steps in the dataflow/taint tracking configuration of your query? |
Beta Was this translation helpful? Give feedback.
Thanks, this makes it clear.
What you're seeing is consistent: the source is found inside the
toString
method, which means that there are only dataflow edges from the return value oftoString
to an explicit call that dispatches to that method. Since your second example doesn't include the call explicitly, such an edge doesn't exist.To solve this problem, you can create the edge yourself by adding an additional flow step from the return value of
toString
to accesses of aCustomer
object that happen in an implicittoString
context.For example: