Replies: 2 comments 2 replies
-
What is the errors message ? |
Beta Was this translation helpful? Give feedback.
-
is it this?
As far as I can tell, this is a genuine CodeQL CLI bug, which is hiding reporting proper and actionable errors from your code. I will report this to my colleagues, sorry for the inconvenience! As far as your query goes, it seems the Go documentation was not updated and doesn't give much help for using the new data flow API that we have been rolling out to many languages. You can draw inspiration from guides for other languages, like the javascript one. You can also draw inspiration from existing Go queries like this one. After fiddling around and fighting a bit against the above CLI crash, I could get this to compile fine, which should be a good starting point for you. import go
import semmle.go.dataflow.TaintTracking
import semmle.go.dataflow.DataFlow
module AllToAllConfiguration implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) {
source instanceof DataFlow::ParameterNode
}
predicate isSink(DataFlow::Node sink) {
exists(DataFlow::CallNode call |
call.getTarget().hasQualifiedName("exec", "CommandContext") and
sink = call.getArgument(0)
)
}
}
module MyFlow = TaintTracking::Global<AllToAllConfiguration>;
from MyFlow::PathNode sourceNode, MyFlow::PathNode sinkNode
where MyFlow::flowPath(sourceNode, sinkNode)
select sinkNode,
"Data flows from "
+ sourceNode.getNode().toString()
+ " (param) to "
+ sinkNode.getNode().toString()
+ " (call argument)." |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to learn a bit how to use CodeQL, I wrote the query bellow to try to list all sources to a golang sink
exec.CommandContext
. However, why I try to run it, I get an error and the query just fails.Could you please help, find whats wrong with it ?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions