Dataflow queries identifying flow into struct fields (Golang) #14804
-
Basically I can't get a simple query for identifying flow into struct fields to work and it's driving me insane. Sadly the documentation for individual language libraries is poorly documented. If anyone could help I'd be very grateful.
This query yields no results. So from my understanding that must mean there are no data flow nodes that correspond to struct fields in a composite literal. Why is this? If I assert the sink has a type of StructLitType in my actual data flow query, I also get no results. Although there are data flow nodes that correspond to struct literals unlike the individual fields, yet I get no results.
Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
For context, this finds struct literals which correspond to the dataflow node:
|
Beta Was this translation helpful? Give feedback.
Use
Write.writesField
to define your sink instead -- e.g.codeql/go/ql/src/Security/CWE-322/InsecureHostKeyCallback.ql
Line 63 in 14268f3
You can also use the first argument of writesField to characterise the qualifier that is written to -- e.g.
codeql/go/ql/lib/semmle/go/frameworks/NoSQL.qll
Line 111 in 14268f3