Skip to content

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
Discussion options

You must be logged in to vote

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 of toString 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 a Customer object that happen in an implicit toString context.

For example:

import semmle.code.java.StringFormat
import semmle.code.java.dataflow.FlowSteps

class ImplicitToStringStep extends AdditionalValueStep {
  override 

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@atorralba
Comment options

@atorralba
Comment options

@yuval-piiano
Comment options

@atorralba
Comment options

Answer selected by yuval-piiano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants