Skip to content

Help with query - unable to find path #867

Answered by redsun82
akanksha1331 asked this question in Q&A
Discussion options

You must be logged in to vote

👋 @akanksha1331

Data flow doesn't go automatically from operands to + on strings, as opposed to taint tracking which instead adds that step.

I tested the query works with either one of these changes:

  • either change from DataFlow to TaintTracking (import semmle.code.java.dataflow.TaintTracking and module Flow = TaintTracking::Global<MyFlowConfiguration>
  • or make the sink not the AddExpr, but its operand (which seems slightly more idiomatic for data flow, as typically sinks are arguments or operands):
    predicate isSink(DataFlow::Node sink) {
      exists(AddExpr addExpr, StringLiteral literal |
        sink.asExpr() = addExpr.getRightOperand() and  // <- `isSink` changed here
        addExpr.getLeftOperand(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@akanksha1331
Comment options

Answer selected by akanksha1331
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