Dataflow queries identifying flow into struct fields (Golang) #14804
Answered
by
smowton
0x73746F70626F74686572696E676D65
asked this question in
Q&A
|
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. |
Answered by
smowton
Nov 16, 2023
Replies: 1 comment 1 reply
|
For context, this finds struct literals which correspond to the dataflow node: |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
Write.writesFieldto 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