From cd017db09fac3e1b3b10dbdcc6a0cf2ad1b5b4e7 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Thu, 17 Oct 2024 16:47:09 +0100 Subject: [PATCH] PS: Add taint versions of local flow tests. --- .../local/{test.expected => flow.expected} | 0 .../dataflow/local/{test.ql => flow.ql} | 0 .../dataflow/local/taint.expected | 54 +++++++++++++++++++ .../library-tests/dataflow/local/taint.ql | 7 +++ 4 files changed, 61 insertions(+) rename powershell/ql/test/library-tests/dataflow/local/{test.expected => flow.expected} (100%) rename powershell/ql/test/library-tests/dataflow/local/{test.ql => flow.ql} (100%) create mode 100644 powershell/ql/test/library-tests/dataflow/local/taint.expected create mode 100644 powershell/ql/test/library-tests/dataflow/local/taint.ql diff --git a/powershell/ql/test/library-tests/dataflow/local/test.expected b/powershell/ql/test/library-tests/dataflow/local/flow.expected similarity index 100% rename from powershell/ql/test/library-tests/dataflow/local/test.expected rename to powershell/ql/test/library-tests/dataflow/local/flow.expected diff --git a/powershell/ql/test/library-tests/dataflow/local/test.ql b/powershell/ql/test/library-tests/dataflow/local/flow.ql similarity index 100% rename from powershell/ql/test/library-tests/dataflow/local/test.ql rename to powershell/ql/test/library-tests/dataflow/local/flow.ql diff --git a/powershell/ql/test/library-tests/dataflow/local/taint.expected b/powershell/ql/test/library-tests/dataflow/local/taint.expected new file mode 100644 index 00000000000..03c07af23fd --- /dev/null +++ b/powershell/ql/test/library-tests/dataflow/local/taint.expected @@ -0,0 +1,54 @@ +| test.ps1:1:1:1:4 | a1 | test.ps1:2:6:2:9 | a1 | +| test.ps1:1:7:1:13 | Source | test.ps1:1:1:1:4 | a1 | +| test.ps1:1:7:1:13 | Source | test.ps1:1:1:1:13 | ...=... | +| test.ps1:2:1:2:9 | Sink | test.ps1:2:1:2:9 | pre-return value for Sink | +| test.ps1:2:1:2:9 | Sink | test.ps1:2:1:2:9 | pre-return value for Sink | +| test.ps1:2:1:2:9 | implicit unwrapping of Sink | test.ps1:1:1:17:8 | return value for test.ps1 | +| test.ps1:2:1:2:9 | pre-return value for Sink | test.ps1:2:1:2:9 | implicit unwrapping of Sink | +| test.ps1:2:1:2:9 | pre-return value for Sink | test.ps1:2:1:2:9 | implicit unwrapping of Sink | +| test.ps1:4:1:4:3 | b | test.ps1:5:4:5:6 | b | +| test.ps1:4:6:4:13 | GetBool | test.ps1:4:1:4:3 | b | +| test.ps1:4:6:4:13 | GetBool | test.ps1:4:1:4:13 | ...=... | +| test.ps1:5:4:5:6 | b | test.ps1:10:14:10:16 | b | +| test.ps1:6:5:6:8 | a2 | test.ps1:8:6:8:9 | a2 | +| test.ps1:6:11:6:17 | Source | test.ps1:6:5:6:8 | a2 | +| test.ps1:6:11:6:17 | Source | test.ps1:6:5:6:17 | ...=... | +| test.ps1:8:1:8:9 | Sink | test.ps1:8:1:8:9 | pre-return value for Sink | +| test.ps1:8:1:8:9 | Sink | test.ps1:8:1:8:9 | pre-return value for Sink | +| test.ps1:8:1:8:9 | implicit unwrapping of Sink | test.ps1:1:1:17:8 | return value for test.ps1 | +| test.ps1:8:1:8:9 | pre-return value for Sink | test.ps1:8:1:8:9 | implicit unwrapping of Sink | +| test.ps1:8:1:8:9 | pre-return value for Sink | test.ps1:8:1:8:9 | implicit unwrapping of Sink | +| test.ps1:10:1:10:3 | c | test.ps1:11:6:11:8 | c | +| test.ps1:10:6:10:16 | [...]... | test.ps1:10:1:10:3 | c | +| test.ps1:10:6:10:16 | [...]... | test.ps1:10:1:10:16 | ...=... | +| test.ps1:10:6:10:16 | [...]... | test.ps1:10:6:10:16 | [...]... | +| test.ps1:10:14:10:16 | b | test.ps1:10:6:10:16 | [...]... | +| test.ps1:11:1:11:8 | Sink | test.ps1:11:1:11:8 | pre-return value for Sink | +| test.ps1:11:1:11:8 | Sink | test.ps1:11:1:11:8 | pre-return value for Sink | +| test.ps1:11:1:11:8 | implicit unwrapping of Sink | test.ps1:1:1:17:8 | return value for test.ps1 | +| test.ps1:11:1:11:8 | pre-return value for Sink | test.ps1:11:1:11:8 | implicit unwrapping of Sink | +| test.ps1:11:1:11:8 | pre-return value for Sink | test.ps1:11:1:11:8 | implicit unwrapping of Sink | +| test.ps1:11:6:11:8 | [post] c | test.ps1:13:7:13:9 | c | +| test.ps1:11:6:11:8 | c | test.ps1:13:7:13:9 | c | +| test.ps1:13:1:13:3 | d | test.ps1:14:6:14:8 | d | +| test.ps1:13:6:13:10 | (...) | test.ps1:13:1:13:3 | d | +| test.ps1:13:6:13:10 | (...) | test.ps1:13:1:13:10 | ...=... | +| test.ps1:13:6:13:10 | (...) | test.ps1:13:6:13:10 | (...) | +| test.ps1:13:7:13:9 | c | test.ps1:13:6:13:10 | (...) | +| test.ps1:13:7:13:9 | c | test.ps1:13:7:13:9 | c | +| test.ps1:14:1:14:8 | Sink | test.ps1:14:1:14:8 | pre-return value for Sink | +| test.ps1:14:1:14:8 | Sink | test.ps1:14:1:14:8 | pre-return value for Sink | +| test.ps1:14:1:14:8 | implicit unwrapping of Sink | test.ps1:1:1:17:8 | return value for test.ps1 | +| test.ps1:14:1:14:8 | pre-return value for Sink | test.ps1:14:1:14:8 | implicit unwrapping of Sink | +| test.ps1:14:1:14:8 | pre-return value for Sink | test.ps1:14:1:14:8 | implicit unwrapping of Sink | +| test.ps1:14:6:14:8 | [post] d | test.ps1:16:6:16:8 | d | +| test.ps1:14:6:14:8 | d | test.ps1:16:6:16:8 | d | +| test.ps1:16:1:16:3 | e | test.ps1:17:6:17:8 | e | +| test.ps1:16:6:16:12 | ...+... | test.ps1:16:1:16:3 | e | +| test.ps1:16:6:16:12 | ...+... | test.ps1:16:1:16:12 | ...=... | +| test.ps1:16:6:16:12 | ...+... | test.ps1:16:6:16:12 | ...+... | +| test.ps1:17:1:17:8 | Sink | test.ps1:17:1:17:8 | pre-return value for Sink | +| test.ps1:17:1:17:8 | Sink | test.ps1:17:1:17:8 | pre-return value for Sink | +| test.ps1:17:1:17:8 | implicit unwrapping of Sink | test.ps1:1:1:17:8 | return value for test.ps1 | +| test.ps1:17:1:17:8 | pre-return value for Sink | test.ps1:17:1:17:8 | implicit unwrapping of Sink | +| test.ps1:17:1:17:8 | pre-return value for Sink | test.ps1:17:1:17:8 | implicit unwrapping of Sink | diff --git a/powershell/ql/test/library-tests/dataflow/local/taint.ql b/powershell/ql/test/library-tests/dataflow/local/taint.ql new file mode 100644 index 00000000000..1343d3c5edc --- /dev/null +++ b/powershell/ql/test/library-tests/dataflow/local/taint.ql @@ -0,0 +1,7 @@ +import powershell +import semmle.code.powershell.dataflow.TaintTracking +import semmle.code.powershell.dataflow.DataFlow + +from DataFlow::Node pred, DataFlow::Node succ +where TaintTracking::localTaintStep(pred, succ) +select pred, succ \ No newline at end of file