Skip to content

Commit

Permalink
add "Dereference" content for PointerContent
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-mc committed Jun 14, 2023
1 parent d071b46 commit d9faee1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions go/ql/lib/semmle/go/dataflow/ExternalFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ predicate parseContent(string component, DataFlow::Content content) {
component = "MapKey" and content instanceof DataFlow::MapKeyContent
or
component = "MapValue" and content instanceof DataFlow::MapValueContent
or
component = "Dereference" and content instanceof DataFlow::PointerContent
}

cached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ extensions:
- ["github.com/nonexistent/test", "", False, "GetMapKey", "", "", "Argument[0].MapKey", "ReturnValue", "value", "manual"]
- ["github.com/nonexistent/test", "", False, "SetElement", "", "", "Argument[0]", "ReturnValue.Element", "value", "manual"]
- ["github.com/nonexistent/test", "C", False, "Get", "", "", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
- ["github.com/nonexistent/test", "C", False, "GetThroughPointer", "", "", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
- ["github.com/nonexistent/test", "C", False, "GetThroughPointer", "", "", "Argument[-1].Dereference.Field[github.com/nonexistent/test.C.F]", "ReturnValue", "value", "manual"]
- ["github.com/nonexistent/test", "C", False, "Set", "", "", "Argument[0]", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "value", "manual"]
- ["github.com/nonexistent/test", "C", False, "SetThroughPointer", "", "", "Argument[0]", "Argument[-1].Field[github.com/nonexistent/test.C.F]", "value", "manual"]
- ["github.com/nonexistent/test", "C", False, "SetThroughPointer", "", "", "Argument[0]", "Argument[-1].Dereference.Field[github.com/nonexistent/test.C.F]", "value", "manual"]

- addsTo:
pack: codeql/go-all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ func simpleflow() {

cp1 := &test.C{""}
cp1.SetThroughPointer(a.Src1().(string))
b.Sink1(cp1.F) // $ MISSING: hasTaintFlow="selection of F"
b.Sink1(cp1.F) // $ hasTaintFlow="selection of F"

cp2 := &test.C{a.Src1().(string)}
b.Sink1(cp2.GetThroughPointer()) // $ MISSING: hasTaintFlow="call to GetThroughPointer"
b.Sink1(cp2.GetThroughPointer()) // $ hasTaintFlow="call to GetThroughPointer"

cp3 := &test.C{""}
cp3.SetThroughPointer(a.Src1().(string))
Expand Down

0 comments on commit d9faee1

Please sign in to comment.