From 12213a0a0814131fdfe0f5a2922261726f223629 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 23 Feb 2024 18:39:16 +0000 Subject: [PATCH] Add test --- .../dataflow/MapReadsAndStores/Flows.expected | 0 .../go/dataflow/MapReadsAndStores/Flows.ql | 3 +++ .../go/dataflow/MapReadsAndStores/test.go | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.expected create mode 100644 go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/Flows.ql create mode 100644 go/ql/test/library-tests/semmle/go/dataflow/MapReadsAndStores/test.go 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" + } +}