Codeql To detect log injection of sensitive data doesn't catch implicit toString() call #13065
Answered
by
atorralba
yuval-piiano
asked this question in
Q&A
|
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, |
Answered by
atorralba
May 8, 2023
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? |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: