0

How can I get all different paths to specific method?


import csharp
import DataFlow::PathGraph

class TaintTrackingConfiguration extends TaintTracking::Configuration {
  TaintTrackingConfiguration() { this = "TaintTrackingConfiguration" }

  override predicate isSource(DataFlow::Node source) {
    exists(MethodAccess ma | ma = source.asExpr().(MethodAccess))
  }
  override predicate isSink(DataFlow::Node sink) {
    exists(MethodAccess ma | ma.getTarget().getName() = "MyMethodName")
  }
}

from DataFlow::PathNode source, DataFlow::PathNode sink, TaintTrackingConfiguration c
where c.hasFlow(source.getNode(), sink.getNode())
select source.getNode(), source, sink, "A -> $@ -> B", sink.getNode(), "CCC"

tried to get a tree like paths to specific method

3
  • 1
    this is definitly no valid C#, no idea about codeql, though. You need to be way more specific on what you want to achieve and what you've tried, as well as how thiis attempts failed your expactations. Commented Nov 13, 2023 at 16:09
  • I googled CodeQL and yep, that looks like that. It's not C# though. I'm guessing you tagged C# because you're trying to analyze C# code, right? Commented Nov 13, 2023 at 16:13
  • @EtiennedeMartel yes Commented Nov 13, 2023 at 16:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.