diff --git a/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.expected b/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.expected new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.ql b/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.ql new file mode 100644 index 000000000000..1b27b27d6dc2 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.ql @@ -0,0 +1,3 @@ +import go +import TestUtilities.InlineFlowTest +import DefaultFlowTest diff --git a/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/test.go b/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/test.go new file mode 100644 index 000000000000..b27443a6d895 --- /dev/null +++ b/go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/test.go @@ -0,0 +1,17 @@ +package main + +func source() string { + return "untrusted data" +} + +func sink(any) { +} + +func main() { + var someMap map[string]string = map[string]string{} + someMap["someKey"] = source() + + for _, val := range someMap { + sink(val) // $ hasValueFlow="val" + } +}