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
toStringmethod, which means that there are only dataflow edges from the return value oftoStringto 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
toStringto accesses of aCustomerobject that happen in an implicittoStringcontext.For example: