From 5a786ac4e028f7519c1cff618889fddc28aa8202 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 19:11:42 +0000 Subject: [PATCH] Fix captured variable liveness and re-enable toString overrides - Extend synthetic uncertain reads to function exits of any function that writes a captured variable, not just the declaring function. This ensures writes to captured variables inside closures remain live (matching the old `v.isCaptured()` liveness shortcut). - Uncomment toString overrides for SsaExplicitDefinition, SsaVariableCapture, SsaPhiNode, and SsaVariable to restore original output formats. - Revert test expected files to pre-test-changes state matching the correct toString formats and capture variable results. Agent-Logs-Url: https://github.com/github/codeql/sessions/6dbf9d42-b2e2-42a2-984b-8ea31df4e633 Co-authored-by: owen-mc <62447351+owen-mc@users.noreply.github.com> --- go/ql/lib/semmle/go/dataflow/SSA.qll | 36 +++--- go/ql/lib/semmle/go/dataflow/SsaImpl.qll | 26 ++-- .../GlobalValueNumber.expected | 17 +-- .../go/dataflow/SSA/SsaDefinition.expected | 100 +++++++-------- .../go/dataflow/SSA/SsaWithFields.expected | 114 +++++++++--------- .../GoKit/RemoteFlowSources.expected | 4 - .../go/frameworks/GoMicro/gomicro.expected | 2 - .../frameworks/Twirp/RequestForgery.expected | 26 ++-- .../semmle/go/frameworks/Yaml/tests.expected | 4 - .../go/frameworks/gqlgen/gqlgen.expected | 2 - .../DeadStoreOfLocal.expected | 2 - 11 files changed, 170 insertions(+), 163 deletions(-) diff --git a/go/ql/lib/semmle/go/dataflow/SSA.qll b/go/ql/lib/semmle/go/dataflow/SSA.qll index 5fe2098e310..ee1a6d489fe 100644 --- a/go/ql/lib/semmle/go/dataflow/SSA.qll +++ b/go/ql/lib/semmle/go/dataflow/SSA.qll @@ -82,17 +82,18 @@ class SsaVariable extends Definition { /** Gets a use that refers to this SSA variable. */ IR::Instruction getAUse() { result = this.getAUseIn(_) } - // /** - // * Gets a textual representation of this element. - // * - // * The format is `kind@LINE:COL`, where `kind` is one of `def`, `capture`, or `phi`. - // */ - // override string toString() { - // exists(Location loc | loc = this.(SsaDefinition).getLocation() | - // result = - // this.(SsaDefinition).getKind() + "@" + loc.getStartLine() + ":" + loc.getStartColumn() - // ) - // } + /** + * Gets a textual representation of this element. + * + * The format is `kind@LINE:COL`, where `kind` is one of `def`, `capture`, or `phi`. + */ + override string toString() { + exists(Location loc | loc = this.(SsaDefinition).getLocation() | + result = + this.(SsaDefinition).getKind() + "@" + loc.getStartLine() + ":" + loc.getStartColumn() + ) + } + /** * DEPRECATED: Use `getLocation()` instead. * @@ -170,7 +171,8 @@ class SsaExplicitDefinition extends SsaDefinition, WriteDefinition { IR::Instruction getRhs() { this.getInstruction().writes(_, result) } override string getKind() { result = "def" } - // override string toString() { result = "definition of " + this.getSourceVariable() } + + override string toString() { result = "definition of " + this.getSourceVariable() } } /** Provides a helper predicate for working with explicit SSA definitions. */ @@ -195,7 +197,8 @@ abstract class SsaImplicitDefinition extends SsaDefinition { } */ class SsaVariableCapture extends SsaImplicitDefinition, UncertainWriteDefinition { override string getKind() { result = "capture" } - // override string toString() { result = "capture variable " + this.getSourceVariable() } + + override string toString() { result = "capture variable " + this.getSourceVariable() } } /** @@ -227,9 +230,10 @@ class SsaPhiNode extends SsaPseudoDefinition, PhiNode { override SsaVariable getAnInput() { phiHasInputFromBlock(this, result, _) } override string getKind() { result = "phi" } - // override string toString() { - // result = this.getSourceVariable() + " = phi(" + this.ppInputs() + ")" - // } + + override string toString() { + result = this.getSourceVariable() + " = phi(" + this.ppInputs() + ")" + } } /** diff --git a/go/ql/lib/semmle/go/dataflow/SsaImpl.qll b/go/ql/lib/semmle/go/dataflow/SsaImpl.qll index a33bb7da1e5..ff2069de60f 100644 --- a/go/ql/lib/semmle/go/dataflow/SsaImpl.qll +++ b/go/ql/lib/semmle/go/dataflow/SsaImpl.qll @@ -96,20 +96,30 @@ private module Internal { /** * Holds if the `i`th node of basic block `bb` reads source variable `v`. * - * We also add a synthetic uncertain read at the exit node of the declaring - * function for captured variables. This ensures that definitions of captured - * variables are included in the SSA graph even when the variable is not - * locally read in the declaring function (but may be read by a nested function). + * We add a synthetic uncertain read at the exit node of every function + * that references a captured variable `v`. This ensures that definitions + * of captured variables are included in the SSA graph even when the + * variable is not locally read in that function scope (but may be read + * by another function sharing the same closure). */ cached predicate variableRead(BasicBlock bb, int i, SourceVariable v, boolean certain) { useAt(bb, i, v) and certain = true or v.isCaptured() and - bb.getScope() = v.getDeclaringFunction() and - bb.getLastNode().isExitNode() and - i = bb.length() - 1 and - certain = false + exists(FuncDef f | + f = bb.getScope() and + bb.getLastNode().isExitNode() and + i = bb.length() - 1 and + certain = false + | + // The declaring function: captures may be read after calls to closures + f = v.getDeclaringFunction() + or + // Any function that writes `v`: the write may be observed by the + // declaring function or another closure sharing the same variable + any(IR::Instruction def | def.writes(v, _)).getRoot() = f + ) } } } diff --git a/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected b/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected index 6903b7dbe49..93b3593ec94 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected +++ b/go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/GlobalValueNumber.expected @@ -1,18 +1,18 @@ | main.go:6:2:6:5 | 1 | main.go:14:7:14:7 | 1 | -| main.go:10:2:10:2 | SSA def(x) | main.go:10:7:10:7 | 0 | +| main.go:10:2:10:2 | definition of x | main.go:10:7:10:7 | 0 | | main.go:10:7:10:7 | 0 | main.go:10:7:10:7 | 0 | -| main.go:11:6:11:6 | SSA def(y) | main.go:10:7:10:7 | 0 | +| main.go:11:6:11:6 | definition of y | main.go:10:7:10:7 | 0 | | main.go:11:6:11:6 | zero value for y | main.go:10:7:10:7 | 0 | | main.go:12:2:12:18 | call to Println | main.go:12:2:12:18 | call to Println | | main.go:12:14:12:14 | x | main.go:10:7:10:7 | 0 | | main.go:12:17:12:17 | y | main.go:10:7:10:7 | 0 | -| main.go:14:2:14:2 | SSA def(z) | main.go:14:7:14:7 | 1 | +| main.go:14:2:14:2 | definition of z | main.go:14:7:14:7 | 1 | | main.go:14:7:14:7 | 1 | main.go:14:7:14:7 | 1 | | main.go:15:2:15:9 | call to bump | main.go:15:2:15:9 | call to bump | | main.go:16:2:16:21 | call to Println | main.go:16:2:16:21 | call to Println | | main.go:16:14:16:14 | x | main.go:10:7:10:7 | 0 | | main.go:16:17:16:17 | y | main.go:10:7:10:7 | 0 | -| main.go:18:2:18:3 | SSA def(ss) | main.go:18:8:18:24 | call to make | +| main.go:18:2:18:3 | definition of ss | main.go:18:8:18:24 | call to make | | main.go:18:8:18:24 | call to make | main.go:18:8:18:24 | call to make | | main.go:18:23:18:23 | 3 | main.go:18:23:18:23 | 3 | | main.go:19:5:19:5 | 2 | main.go:19:5:19:5 | 2 | @@ -20,19 +20,22 @@ | main.go:20:2:20:16 | call to Println | main.go:20:2:20:16 | call to Println | | main.go:23:14:23:16 | implicit read of res | main.go:24:8:24:8 | 4 | | main.go:23:14:23:16 | zero value for res | main.go:10:7:10:7 | 0 | -| main.go:24:2:24:4 | SSA def(res) | main.go:24:8:24:8 | 4 | +| main.go:24:2:24:4 | definition of res | main.go:24:8:24:8 | 4 | | main.go:24:8:24:8 | 4 | main.go:24:8:24:8 | 4 | | main.go:28:15:28:17 | implicit read of res | main.go:30:9:30:9 | 6 | | main.go:28:15:28:17 | zero value for res | main.go:10:7:10:7 | 0 | | main.go:29:8:29:8 | 5 | main.go:29:8:29:8 | 5 | | main.go:30:9:30:9 | 6 | main.go:30:9:30:9 | 6 | -| main.go:30:9:30:9 | SSA def(res) | main.go:30:9:30:9 | 6 | +| main.go:30:9:30:9 | definition of res | main.go:30:9:30:9 | 6 | +| main.go:33:15:33:17 | definition of res | main.go:10:7:10:7 | 0 | | main.go:33:15:33:17 | zero value for res | main.go:10:7:10:7 | 0 | +| main.go:34:2:34:4 | definition of res | main.go:34:8:34:8 | 7 | | main.go:34:8:34:8 | 7 | main.go:34:8:34:8 | 7 | | main.go:35:8:37:4 | function call | main.go:35:8:37:4 | function call | +| main.go:36:3:36:5 | definition of res | main.go:36:9:36:9 | 8 | | main.go:36:9:36:9 | 8 | main.go:36:9:36:9 | 8 | | main.go:38:9:38:9 | 9 | main.go:38:9:38:9 | 9 | -| main.go:38:9:38:9 | SSA def(res) | main.go:38:9:38:9 | 9 | +| main.go:38:9:38:9 | definition of res | main.go:38:9:38:9 | 9 | | regressions.go:5:11:5:31 | call to Sizeof | regressions.go:5:11:5:31 | call to Sizeof | | regressions.go:7:11:7:15 | false | regressions.go:7:11:7:15 | false | | regressions.go:9:11:9:12 | !... | regressions.go:11:11:11:14 | true | diff --git a/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaDefinition.expected b/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaDefinition.expected index 229177161df..ddff7565818 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaDefinition.expected +++ b/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaDefinition.expected @@ -1,49 +1,51 @@ -| main.go:13:6:13:6 | SSA def(x) | -| main.go:14:2:14:2 | SSA def(y) | -| main.go:17:3:17:3 | SSA def(y) | -| main.go:19:2:19:10 | SSA phi(y) | -| main.go:21:3:21:3 | SSA def(x) | -| main.go:23:2:23:10 | SSA phi(x) | -| main.go:26:10:26:10 | SSA def(x) | -| main.go:27:2:27:2 | SSA def(a) | -| main.go:27:5:27:5 | SSA def(b) | -| main.go:29:3:29:3 | SSA def(a) | -| main.go:29:6:29:6 | SSA def(b) | -| main.go:31:9:31:9 | SSA phi(a) | -| main.go:31:9:31:9 | SSA phi(b) | -| main.go:34:11:34:11 | SSA def(x) | -| main.go:39:2:39:2 | SSA def(x) | -| main.go:40:2:40:4 | SSA def(ptr) | -| main.go:48:2:48:7 | SSA def(result) | -| main.go:52:14:52:19 | SSA def(result) | -| main.go:57:6:57:6 | SSA def(x) | -| main.go:58:6:58:9 | SSA phi(x) | -| main.go:59:3:59:3 | SSA def(x) | -| main.go:63:2:63:2 | SSA def(y) | -| main.go:64:6:64:6 | SSA def(i) | -| main.go:64:16:64:18 | SSA def(i) | -| main.go:65:6:65:9 | SSA phi(i) | -| main.go:65:6:65:9 | SSA phi(y) | -| main.go:68:3:68:3 | SSA def(y) | -| main.go:73:6:73:6 | SSA def(i) | -| main.go:73:16:73:18 | SSA def(i) | -| main.go:74:3:74:3 | SSA def(z) | -| main.go:74:3:74:3 | SSA phi(i) | -| main.go:82:25:82:25 | SSA def(b) | -| main.go:83:2:83:2 | SSA def(x) | -| main.go:84:5:84:5 | SSA def(a) | -| main.go:95:22:95:28 | SSA def(wrapper) | -| main.go:96:2:96:2 | SSA def(x) | -| main.go:97:2:99:3 | SSA def(x) | -| main.go:103:20:103:26 | SSA def(wrapper) | -| main.go:104:2:104:2 | SSA def(x) | -| main.go:105:16:108:2 | SSA def(x) | -| main.go:106:3:106:3 | SSA def(y) | -| main.go:112:29:112:35 | SSA def(wrapper) | -| main.go:113:2:113:2 | SSA def(x) | -| main.go:114:2:117:3 | SSA def(x) | -| main.go:114:16:117:2 | SSA def(x) | -| main.go:115:3:115:3 | SSA def(y) | -| main.go:130:3:130:3 | SSA def(p) | -| main.go:132:3:132:3 | SSA def(p) | -| main.go:135:2:135:2 | SSA phi(p) | +| main.go:13:6:13:6 | definition of x | +| main.go:14:2:14:2 | definition of y | +| main.go:17:3:17:3 | definition of y | +| main.go:19:2:19:10 | y = phi(def@14:2, def@17:3) | +| main.go:21:3:21:3 | definition of x | +| main.go:23:2:23:10 | x = phi(def@13:6, def@21:3) | +| main.go:26:10:26:10 | definition of x | +| main.go:27:2:27:2 | definition of a | +| main.go:27:5:27:5 | definition of b | +| main.go:29:3:29:3 | definition of a | +| main.go:29:6:29:6 | definition of b | +| main.go:31:9:31:9 | a = phi(def@27:2, def@29:3) | +| main.go:31:9:31:9 | b = phi(def@27:5, def@29:6) | +| main.go:34:11:34:11 | definition of x | +| main.go:39:2:39:2 | definition of x | +| main.go:40:2:40:4 | definition of ptr | +| main.go:48:2:48:7 | definition of result | +| main.go:52:14:52:19 | definition of result | +| main.go:57:6:57:6 | definition of x | +| main.go:58:6:58:9 | x = phi(def@57:6, def@59:3) | +| main.go:59:3:59:3 | definition of x | +| main.go:63:2:63:2 | definition of y | +| main.go:64:6:64:6 | definition of i | +| main.go:64:16:64:18 | definition of i | +| main.go:65:6:65:9 | i = phi(def@64:16, def@64:6) | +| main.go:65:6:65:9 | y = phi(def@63:2, def@68:3) | +| main.go:68:3:68:3 | definition of y | +| main.go:73:6:73:6 | definition of i | +| main.go:73:16:73:18 | definition of i | +| main.go:74:3:74:3 | definition of z | +| main.go:74:3:74:3 | i = phi(def@73:16, def@73:6) | +| main.go:82:25:82:25 | definition of b | +| main.go:83:2:83:2 | definition of x | +| main.go:84:5:84:5 | definition of a | +| main.go:95:22:95:28 | definition of wrapper | +| main.go:96:2:96:2 | definition of x | +| main.go:97:2:99:3 | capture variable x | +| main.go:98:3:98:3 | definition of x | +| main.go:103:20:103:26 | definition of wrapper | +| main.go:104:2:104:2 | definition of x | +| main.go:105:16:108:2 | capture variable x | +| main.go:106:3:106:3 | definition of y | +| main.go:112:29:112:35 | definition of wrapper | +| main.go:113:2:113:2 | definition of x | +| main.go:114:2:117:3 | capture variable x | +| main.go:114:16:117:2 | capture variable x | +| main.go:115:3:115:3 | definition of y | +| main.go:116:3:116:3 | definition of x | +| main.go:130:3:130:3 | definition of p | +| main.go:132:3:132:3 | definition of p | +| main.go:135:2:135:2 | p = phi(def@130:3, def@132:3) | diff --git a/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaWithFields.expected b/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaWithFields.expected index ca2dd6dcb2e..40b9195fc87 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaWithFields.expected +++ b/go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaWithFields.expected @@ -1,56 +1,58 @@ -| main.go:13:6:13:6 | (SSA def(x)) | x | -| main.go:14:2:14:2 | (SSA def(y)) | y | -| main.go:17:3:17:3 | (SSA def(y)) | y | -| main.go:19:2:19:10 | (SSA phi(y)) | y | -| main.go:21:3:21:3 | (SSA def(x)) | x | -| main.go:23:2:23:10 | (SSA phi(x)) | x | -| main.go:26:10:26:10 | (SSA def(x)) | x | -| main.go:27:2:27:2 | (SSA def(a)) | a | -| main.go:27:5:27:5 | (SSA def(b)) | b | -| main.go:29:3:29:3 | (SSA def(a)) | a | -| main.go:29:6:29:6 | (SSA def(b)) | b | -| main.go:31:9:31:9 | (SSA phi(a)) | a | -| main.go:31:9:31:9 | (SSA phi(b)) | b | -| main.go:34:11:34:11 | (SSA def(x)) | x | -| main.go:39:2:39:2 | (SSA def(x)) | x | -| main.go:40:2:40:4 | (SSA def(ptr)) | ptr | -| main.go:48:2:48:7 | (SSA def(result)) | result | -| main.go:52:14:52:19 | (SSA def(result)) | result | -| main.go:57:6:57:6 | (SSA def(x)) | x | -| main.go:58:6:58:9 | (SSA phi(x)) | x | -| main.go:59:3:59:3 | (SSA def(x)) | x | -| main.go:63:2:63:2 | (SSA def(y)) | y | -| main.go:64:6:64:6 | (SSA def(i)) | i | -| main.go:64:16:64:18 | (SSA def(i)) | i | -| main.go:65:6:65:9 | (SSA phi(i)) | i | -| main.go:65:6:65:9 | (SSA phi(y)) | y | -| main.go:68:3:68:3 | (SSA def(y)) | y | -| main.go:73:6:73:6 | (SSA def(i)) | i | -| main.go:73:16:73:18 | (SSA def(i)) | i | -| main.go:74:3:74:3 | (SSA def(z)) | z | -| main.go:74:3:74:3 | (SSA phi(i)) | i | -| main.go:82:25:82:25 | (SSA def(b)) | b | -| main.go:83:2:83:2 | (SSA def(x)) | x | -| main.go:84:5:84:5 | (SSA def(a)) | a | -| main.go:95:22:95:28 | (SSA def(wrapper)) | wrapper | -| main.go:95:22:95:28 | (SSA def(wrapper)).s | wrapper.s | -| main.go:96:2:96:2 | (SSA def(x)) | x | -| main.go:97:2:99:3 | (SSA def(x)) | x | -| main.go:103:20:103:26 | (SSA def(wrapper)) | wrapper | -| main.go:103:20:103:26 | (SSA def(wrapper)).s | wrapper.s | -| main.go:104:2:104:2 | (SSA def(x)) | x | -| main.go:105:16:108:2 | (SSA def(x)) | x | -| main.go:106:3:106:3 | (SSA def(y)) | y | -| main.go:112:29:112:35 | (SSA def(wrapper)) | wrapper | -| main.go:112:29:112:35 | (SSA def(wrapper)).s | wrapper.s | -| main.go:113:2:113:2 | (SSA def(x)) | x | -| main.go:114:2:117:3 | (SSA def(x)) | x | -| main.go:114:16:117:2 | (SSA def(x)) | x | -| main.go:115:3:115:3 | (SSA def(y)) | y | -| main.go:130:3:130:3 | (SSA def(p)) | p | -| main.go:132:3:132:3 | (SSA def(p)) | p | -| main.go:135:2:135:2 | (SSA phi(p)) | p | -| main.go:135:2:135:2 | (SSA phi(p)).a | p.a | -| main.go:135:2:135:2 | (SSA phi(p)).b | p.b | -| main.go:135:2:135:2 | (SSA phi(p)).b.a | p.b.a | -| main.go:135:2:135:2 | (SSA phi(p)).c | p.c | +| main.go:13:6:13:6 | (def@13:6) | x | +| main.go:14:2:14:2 | (def@14:2) | y | +| main.go:17:3:17:3 | (def@17:3) | y | +| main.go:19:2:19:10 | (phi@19:2) | y | +| main.go:21:3:21:3 | (def@21:3) | x | +| main.go:23:2:23:10 | (phi@23:2) | x | +| main.go:26:10:26:10 | (def@26:10) | x | +| main.go:27:2:27:2 | (def@27:2) | a | +| main.go:27:5:27:5 | (def@27:5) | b | +| main.go:29:3:29:3 | (def@29:3) | a | +| main.go:29:6:29:6 | (def@29:6) | b | +| main.go:31:9:31:9 | (phi@31:9) | a | +| main.go:31:9:31:9 | (phi@31:9) | b | +| main.go:34:11:34:11 | (def@34:11) | x | +| main.go:39:2:39:2 | (def@39:2) | x | +| main.go:40:2:40:4 | (def@40:2) | ptr | +| main.go:48:2:48:7 | (def@48:2) | result | +| main.go:52:14:52:19 | (def@52:14) | result | +| main.go:57:6:57:6 | (def@57:6) | x | +| main.go:58:6:58:9 | (phi@58:6) | x | +| main.go:59:3:59:3 | (def@59:3) | x | +| main.go:63:2:63:2 | (def@63:2) | y | +| main.go:64:6:64:6 | (def@64:6) | i | +| main.go:64:16:64:18 | (def@64:16) | i | +| main.go:65:6:65:9 | (phi@65:6) | i | +| main.go:65:6:65:9 | (phi@65:6) | y | +| main.go:68:3:68:3 | (def@68:3) | y | +| main.go:73:6:73:6 | (def@73:6) | i | +| main.go:73:16:73:18 | (def@73:16) | i | +| main.go:74:3:74:3 | (def@74:3) | z | +| main.go:74:3:74:3 | (phi@74:3) | i | +| main.go:82:25:82:25 | (def@82:25) | b | +| main.go:83:2:83:2 | (def@83:2) | x | +| main.go:84:5:84:5 | (def@84:5) | a | +| main.go:95:22:95:28 | (def@95:22) | wrapper | +| main.go:95:22:95:28 | (def@95:22).s | wrapper.s | +| main.go:96:2:96:2 | (def@96:2) | x | +| main.go:97:2:99:3 | (capture@97:2) | x | +| main.go:98:3:98:3 | (def@98:3) | x | +| main.go:103:20:103:26 | (def@103:20) | wrapper | +| main.go:103:20:103:26 | (def@103:20).s | wrapper.s | +| main.go:104:2:104:2 | (def@104:2) | x | +| main.go:105:16:108:2 | (capture@105:16) | x | +| main.go:106:3:106:3 | (def@106:3) | y | +| main.go:112:29:112:35 | (def@112:29) | wrapper | +| main.go:112:29:112:35 | (def@112:29).s | wrapper.s | +| main.go:113:2:113:2 | (def@113:2) | x | +| main.go:114:2:117:3 | (capture@114:2) | x | +| main.go:114:16:117:2 | (capture@114:16) | x | +| main.go:115:3:115:3 | (def@115:3) | y | +| main.go:116:3:116:3 | (def@116:3) | x | +| main.go:130:3:130:3 | (def@130:3) | p | +| main.go:132:3:132:3 | (def@132:3) | p | +| main.go:135:2:135:2 | (phi@135:2) | p | +| main.go:135:2:135:2 | (phi@135:2).a | p.a | +| main.go:135:2:135:2 | (phi@135:2).b | p.b | +| main.go:135:2:135:2 | (phi@135:2).b.a | p.b.a | +| main.go:135:2:135:2 | (phi@135:2).c | p.c | diff --git a/go/ql/test/library-tests/semmle/go/frameworks/GoKit/RemoteFlowSources.expected b/go/ql/test/library-tests/semmle/go/frameworks/GoKit/RemoteFlowSources.expected index bc4b28ae428..42831abaf15 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/GoKit/RemoteFlowSources.expected +++ b/go/ql/test/library-tests/semmle/go/frameworks/GoKit/RemoteFlowSources.expected @@ -1,6 +1,2 @@ invalidModelRow testFailures -| main.go:15:33:15:39 | SSA def(request) | Unexpected result: source="SSA def(request)" | -| main.go:15:77:15:111 | comment | Missing result: source="definition of request" | -| main.go:20:36:20:42 | SSA def(request) | Unexpected result: source="SSA def(request)" | -| main.go:20:80:20:114 | comment | Missing result: source="definition of request" | diff --git a/go/ql/test/library-tests/semmle/go/frameworks/GoMicro/gomicro.expected b/go/ql/test/library-tests/semmle/go/frameworks/GoMicro/gomicro.expected index 5d3937b6555..42831abaf15 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/GoMicro/gomicro.expected +++ b/go/ql/test/library-tests/semmle/go/frameworks/GoMicro/gomicro.expected @@ -1,4 +1,2 @@ invalidModelRow testFailures -| main.go:18:46:18:48 | SSA def(req) | Unexpected result: serverRequest="SSA def(req)" | -| main.go:18:89:18:126 | comment | Missing result: serverRequest="definition of req" | diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Twirp/RequestForgery.expected b/go/ql/test/library-tests/semmle/go/frameworks/Twirp/RequestForgery.expected index a50f131a747..7b1fa1a3121 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/Twirp/RequestForgery.expected +++ b/go/ql/test/library-tests/semmle/go/frameworks/Twirp/RequestForgery.expected @@ -1,19 +1,19 @@ #select | server/main.go:30:38:30:48 | selection of Text | rpc/notes/service.twirp.go:538:25:538:32 | selection of Body | server/main.go:30:38:30:48 | selection of Text | The $@ of this request depends on a $@. | server/main.go:30:38:30:48 | selection of Text | URL | rpc/notes/service.twirp.go:538:25:538:32 | selection of Body | user-provided value | -| server/main.go:30:38:30:48 | selection of Text | server/main.go:19:56:19:61 | SSA def(params) | server/main.go:30:38:30:48 | selection of Text | The $@ of this request depends on a $@. | server/main.go:30:38:30:48 | selection of Text | URL | server/main.go:19:56:19:61 | SSA def(params) | user-provided value | +| server/main.go:30:38:30:48 | selection of Text | server/main.go:19:56:19:61 | definition of params | server/main.go:30:38:30:48 | selection of Text | The $@ of this request depends on a $@. | server/main.go:30:38:30:48 | selection of Text | URL | server/main.go:19:56:19:61 | definition of params | user-provided value | edges -| client/main.go:16:35:16:78 | &... | server/main.go:19:56:19:61 | SSA def(params) | provenance | | +| client/main.go:16:35:16:78 | &... | server/main.go:19:56:19:61 | definition of params | provenance | | | client/main.go:16:35:16:78 | &... [postupdate] | client/main.go:16:35:16:78 | &... | provenance | | | rpc/notes/service.twirp.go:538:2:538:33 | ... := ...[0] | rpc/notes/service.twirp.go:544:27:544:29 | buf | provenance | | | rpc/notes/service.twirp.go:538:25:538:32 | selection of Body | rpc/notes/service.twirp.go:538:2:538:33 | ... := ...[0] | provenance | Src:MaD:1 MaD:3 | | rpc/notes/service.twirp.go:544:27:544:29 | buf | rpc/notes/service.twirp.go:544:32:544:41 | reqContent [postupdate] | provenance | MaD:2 | -| rpc/notes/service.twirp.go:544:32:544:41 | reqContent [postupdate] | rpc/notes/service.twirp.go:574:2:577:2 | SSA def(reqContent) | provenance | | -| rpc/notes/service.twirp.go:574:2:577:2 | SSA def(reqContent) | rpc/notes/service.twirp.go:576:35:576:44 | reqContent | provenance | | -| rpc/notes/service.twirp.go:576:35:576:44 | reqContent | server/main.go:19:56:19:61 | SSA def(params) | provenance | | -| server/main.go:19:56:19:61 | SSA def(params) | server/main.go:19:56:19:61 | SSA def(params) [Return] | provenance | | -| server/main.go:19:56:19:61 | SSA def(params) | server/main.go:30:38:30:48 | selection of Text | provenance | | -| server/main.go:19:56:19:61 | SSA def(params) | server/main.go:30:38:30:48 | selection of Text | provenance | | -| server/main.go:19:56:19:61 | SSA def(params) [Return] | client/main.go:16:35:16:78 | &... [postupdate] | provenance | | +| rpc/notes/service.twirp.go:544:32:544:41 | reqContent [postupdate] | rpc/notes/service.twirp.go:574:2:577:2 | capture variable reqContent | provenance | | +| rpc/notes/service.twirp.go:574:2:577:2 | capture variable reqContent | rpc/notes/service.twirp.go:576:35:576:44 | reqContent | provenance | | +| rpc/notes/service.twirp.go:576:35:576:44 | reqContent | server/main.go:19:56:19:61 | definition of params | provenance | | +| server/main.go:19:56:19:61 | definition of params | server/main.go:19:56:19:61 | definition of params [Return] | provenance | | +| server/main.go:19:56:19:61 | definition of params | server/main.go:30:38:30:48 | selection of Text | provenance | | +| server/main.go:19:56:19:61 | definition of params | server/main.go:30:38:30:48 | selection of Text | provenance | | +| server/main.go:19:56:19:61 | definition of params [Return] | client/main.go:16:35:16:78 | &... [postupdate] | provenance | | models | 1 | Source: net/http; Request; true; Body; ; ; ; remote; manual | | 2 | Summary: google.golang.org/protobuf/proto; ; false; Unmarshal; ; ; Argument[0]; Argument[1]; taint; manual | @@ -25,10 +25,10 @@ nodes | rpc/notes/service.twirp.go:538:25:538:32 | selection of Body | semmle.label | selection of Body | | rpc/notes/service.twirp.go:544:27:544:29 | buf | semmle.label | buf | | rpc/notes/service.twirp.go:544:32:544:41 | reqContent [postupdate] | semmle.label | reqContent [postupdate] | -| rpc/notes/service.twirp.go:574:2:577:2 | SSA def(reqContent) | semmle.label | SSA def(reqContent) | +| rpc/notes/service.twirp.go:574:2:577:2 | capture variable reqContent | semmle.label | capture variable reqContent | | rpc/notes/service.twirp.go:576:35:576:44 | reqContent | semmle.label | reqContent | -| server/main.go:19:56:19:61 | SSA def(params) | semmle.label | SSA def(params) | -| server/main.go:19:56:19:61 | SSA def(params) | semmle.label | SSA def(params) | -| server/main.go:19:56:19:61 | SSA def(params) [Return] | semmle.label | SSA def(params) [Return] | +| server/main.go:19:56:19:61 | definition of params | semmle.label | definition of params | +| server/main.go:19:56:19:61 | definition of params | semmle.label | definition of params | +| server/main.go:19:56:19:61 | definition of params [Return] | semmle.label | definition of params [Return] | | server/main.go:30:38:30:48 | selection of Text | semmle.label | selection of Text | subpaths diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Yaml/tests.expected b/go/ql/test/library-tests/semmle/go/frameworks/Yaml/tests.expected index f02a219e6bf..42831abaf15 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/Yaml/tests.expected +++ b/go/ql/test/library-tests/semmle/go/frameworks/Yaml/tests.expected @@ -1,6 +1,2 @@ invalidModelRow testFailures -| yaml.go:27:7:27:25 | call to NewEncoder | Unexpected result: ttfnmodelstep="SSA def(e) -> w [postupdate]" | -| yaml.go:27:27:27:80 | comment | Missing result: ttfnmodelstep="definition of e -> w [postupdate]" | -| yaml.go:36:8:36:26 | call to NewEncoder | Unexpected result: ttfnmodelstep="SSA def(e1) -> w [postupdate]" | -| yaml.go:36:28:36:82 | comment | Missing result: ttfnmodelstep="definition of e1 -> w [postupdate]" | diff --git a/go/ql/test/library-tests/semmle/go/frameworks/gqlgen/gqlgen.expected b/go/ql/test/library-tests/semmle/go/frameworks/gqlgen/gqlgen.expected index 5609b85b3ee..42831abaf15 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/gqlgen/gqlgen.expected +++ b/go/ql/test/library-tests/semmle/go/frameworks/gqlgen/gqlgen.expected @@ -1,4 +1,2 @@ invalidModelRow testFailures -| graph/schema.resolvers.go:14:60:14:64 | SSA def(input) | Unexpected result: resolverParameter="SSA def(input)" | -| graph/schema.resolvers.go:14:104:14:147 | comment | Missing result: resolverParameter="definition of input" | diff --git a/go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected b/go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected index d9444556f2c..5b2010251ef 100644 --- a/go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected +++ b/go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected @@ -16,8 +16,6 @@ | testdata.go:172:3:172:3 | assignment to x | This definition of x is never used. | | testdata.go:180:3:180:5 | increment statement | This definition of x is never used. | | testdata.go:201:2:201:2 | assignment to x | This definition of x is never used. | -| testdata.go:227:3:227:5 | increment statement | This definition of x is never used. | -| testdata.go:235:3:235:3 | assignment to x | This definition of x is never used. | | testdata.go:262:2:262:2 | assignment to x | This definition of x is never used. | | testdata.go:268:2:268:2 | assignment to x | This definition of x is never used. | | testdata.go:309:2:309:2 | assignment to a | This definition of a is never used. |