From 0564f6970ff9c594d4a4b5a10c0c412a164a5d28 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema <93738568+jketema@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:29:02 +0000 Subject: [PATCH 1/3] Go: Remove outdated deprecated library APIs Remove obsolete framework, scope, location, and data-flow APIs identified by config/blame-deprecations.mjs. Preserve Afero file-access and fasthttp request-body source modeling with private implementations, and remove imports of empty compatibility modules. Keep experimental queries unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7be1d7da-9061-47a8-bf98-b3169476add9 --- .../2026-11-18-outdated-deprecations.md | 5 + go/ql/lib/go.qll | 2 - go/ql/lib/semmle/go/Scopes.qll | 42 -- go/ql/lib/semmle/go/StringOps.qll | 23 -- go/ql/lib/semmle/go/Types.qll | 25 -- go/ql/lib/semmle/go/VariableWithFields.qll | 15 - .../go/controlflow/ControlFlowGraph.qll | 22 -- go/ql/lib/semmle/go/controlflow/IR.qll | 18 - go/ql/lib/semmle/go/dataflow/FlowSummary.qll | 10 - .../go/dataflow/GlobalValueNumbering.qll | 15 - go/ql/lib/semmle/go/dataflow/SSA.qll | 26 -- .../go/dataflow/internal/DataFlowNodes.qll | 15 - .../go/dataflow/internal/DataFlowPrivate.qll | 15 - .../go/dataflow/internal/DataFlowUtil.qll | 44 --- .../go/dataflow/internal/FlowSummaryImpl.qll | 18 - go/ql/lib/semmle/go/frameworks/Afero.qll | 36 -- go/ql/lib/semmle/go/frameworks/Couchbase.qll | 29 -- go/ql/lib/semmle/go/frameworks/Echo.qll | 16 - go/ql/lib/semmle/go/frameworks/Fasthttp.qll | 361 ------------------ go/ql/lib/semmle/go/frameworks/GoMicro.qll | 3 - go/ql/lib/semmle/go/frameworks/Mux.qll | 25 -- go/ql/lib/semmle/go/frameworks/SQL.qll | 7 - .../go/frameworks/SystemCommandExecutors.qll | 15 - go/ql/lib/semmle/go/frameworks/Twirp.qll | 3 - go/ql/lib/semmle/go/frameworks/WebSocket.qll | 11 - go/ql/lib/semmle/go/frameworks/XPath.qll | 21 - go/ql/lib/semmle/go/frameworks/stdlib/Fmt.qll | 16 - .../go/frameworks/stdlib/HtmlTemplate.qll | 15 - .../semmle/go/frameworks/stdlib/NetHttp.qll | 16 - .../CommandInjectionCustomizations.qll | 5 - go/ql/lib/semmle/go/security/FlowSources.qll | 18 - .../security/LogInjectionCustomizations.qll | 5 - .../OpenUrlRedirectCustomizations.qll | 5 - .../security/ReflectedXssCustomizations.qll | 5 - .../security/RequestForgeryCustomizations.qll | 5 - .../security/SqlInjectionCustomizations.qll | 5 - .../go/security/TaintedPathCustomizations.qll | 5 - .../security/XPathInjectionCustomizations.qll | 5 - .../CWE-640/EmailInjectionCustomizations.qll | 5 - .../2026-11-18-outdated-deprecations.md | 4 + .../semmle/go/frameworks/Afero/test.go | 4 +- .../semmle/go/frameworks/Fasthttp/fasthttp.go | 8 +- 42 files changed, 15 insertions(+), 933 deletions(-) create mode 100644 go/ql/lib/change-notes/2026-11-18-outdated-deprecations.md delete mode 100644 go/ql/lib/semmle/go/frameworks/Couchbase.qll delete mode 100644 go/ql/lib/semmle/go/frameworks/Mux.qll create mode 100644 go/ql/src/change-notes/2026-11-18-outdated-deprecations.md diff --git a/go/ql/lib/change-notes/2026-11-18-outdated-deprecations.md b/go/ql/lib/change-notes/2026-11-18-outdated-deprecations.md new file mode 100644 index 000000000000..42a7e3801834 --- /dev/null +++ b/go/ql/lib/change-notes/2026-11-18-outdated-deprecations.md @@ -0,0 +1,5 @@ +--- +category: breaking +--- +* Removed deprecated aliases and predicates from the scope, type, control-flow, data-flow, framework, and security libraries. +* Removed deprecated `hasLocationInfo` predicates. Use `getLocation()` instead. diff --git a/go/ql/lib/go.qll b/go/ql/lib/go.qll index af9f676e0139..340c320472b5 100644 --- a/go/ql/lib/go.qll +++ b/go/ql/lib/go.qll @@ -37,7 +37,6 @@ import semmle.go.frameworks.BeegoOrm import semmle.go.frameworks.Bun import semmle.go.frameworks.CryptoLibraries import semmle.go.frameworks.RsCors -import semmle.go.frameworks.Couchbase import semmle.go.frameworks.Echo import semmle.go.frameworks.ElazarlGoproxy import semmle.go.frameworks.Email @@ -56,7 +55,6 @@ import semmle.go.frameworks.K8sIoApiCoreV1 import semmle.go.frameworks.K8sIoClientGo import semmle.go.frameworks.Logrus import semmle.go.frameworks.Macaron -import semmle.go.frameworks.Mux import semmle.go.frameworks.NoSQL import semmle.go.frameworks.Protobuf import semmle.go.frameworks.Revel diff --git a/go/ql/lib/semmle/go/Scopes.qll b/go/ql/lib/semmle/go/Scopes.qll index 735dbe80d590..c9a8e7adb104 100644 --- a/go/ql/lib/semmle/go/Scopes.qll +++ b/go/ql/lib/semmle/go/Scopes.qll @@ -152,29 +152,6 @@ class Entity extends @object { or result = any(CaseClause cc | this = cc.getImplicitlyDeclaredVariable()).getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - // otherwise fall back on dummy location - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } } /** A declared entity (that is, type, constant, variable or function). */ @@ -209,15 +186,9 @@ class DeclaredTypeEntity extends TypeEntity, DeclaredEntity, TypeParamParentEnti TypeSpec getSpec() { result.getNameExpr() = this.getDeclaration() } } -/** DEPRECATED: Use `DeclaredTypeEntity` instead. */ -deprecated class DeclaredType = DeclaredTypeEntity; - /** A built-in type. */ class BuiltinTypeEntity extends TypeEntity, BuiltinEntity, @builtintypeobject { } -/** DEPRECATED: Use `BuiltinTypeEntity` instead. */ -deprecated class BuiltinType = BuiltinTypeEntity; - /** A built-in or declared constant, variable, field, method or function. */ class ValueEntity extends Entity, @valueobject { /** Gets a data-flow node that reads the value of this entity. */ @@ -702,19 +673,6 @@ class Callable extends TCallable { Location getLocation() { result = this.asFunction().getLocation() or result = this.asFuncLit().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `sc` of line `sl` to - * column `ec` of line `el` in file `fp`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo(string fp, int sl, int sc, int el, int ec) { - this.getLocation().hasLocationInfo(fp, sl, sc, el, ec) - } } /** A statement label. */ diff --git a/go/ql/lib/semmle/go/StringOps.qll b/go/ql/lib/semmle/go/StringOps.qll index a00f8d90b48e..04d1d35c720b 100644 --- a/go/ql/lib/semmle/go/StringOps.qll +++ b/go/ql/lib/semmle/go/StringOps.qll @@ -558,29 +558,6 @@ module StringOps { /** Gets the location of this element. */ Location getLocation() { result = this.asNode().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - // use dummy location for elements that don't have a corresponding node - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } } /** diff --git a/go/ql/lib/semmle/go/Types.qll b/go/ql/lib/semmle/go/Types.qll index 04e0f456276c..a3a62f21328e 100644 --- a/go/ql/lib/semmle/go/Types.qll +++ b/go/ql/lib/semmle/go/Types.qll @@ -148,28 +148,6 @@ class Type extends @type { /** Gets the location of this type. */ Location getLocation() { result = this.getEntity().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } } /** An invalid type. */ @@ -1044,9 +1022,6 @@ class SendRecvChanType extends @sendrcvchantype, ChanType { override string toString() { result = "send-receive-channel type" } } -/** DEPRECATED: Use `DefinedType` instead. */ -deprecated class NamedType = DefinedType; - /** A defined type. */ class DefinedType extends @definedtype, CompositeType { /** diff --git a/go/ql/lib/semmle/go/VariableWithFields.qll b/go/ql/lib/semmle/go/VariableWithFields.qll index 277a7dcc3263..f0ae19bdcf28 100644 --- a/go/ql/lib/semmle/go/VariableWithFields.qll +++ b/go/ql/lib/semmle/go/VariableWithFields.qll @@ -187,19 +187,4 @@ class VariableWithFields extends TVariableWithFields { /** Gets the location of this variable with fields. */ Location getLocation() { result = this.getBaseVariable().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } } diff --git a/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll b/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll index 46473153d9bc..acbebcc87449 100644 --- a/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll +++ b/go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll @@ -80,28 +80,6 @@ module ControlFlow { /** Gets the file to which this node belongs. */ File getFile() { result = this.getLocation().getFile() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } } /** A synthetic entry node for a function or a file. */ diff --git a/go/ql/lib/semmle/go/controlflow/IR.qll b/go/ql/lib/semmle/go/controlflow/IR.qll index f74a23e1155c..15b89ba42316 100644 --- a/go/ql/lib/semmle/go/controlflow/IR.qll +++ b/go/ql/lib/semmle/go/controlflow/IR.qll @@ -1156,24 +1156,6 @@ module IR { /** Gets the source location for this element. */ Location getLocation() { none() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } } /** An implicitly declared variable used as the target of a type-switch case write. */ diff --git a/go/ql/lib/semmle/go/dataflow/FlowSummary.qll b/go/ql/lib/semmle/go/dataflow/FlowSummary.qll index 632697b341f1..a76ef1dad070 100644 --- a/go/ql/lib/semmle/go/dataflow/FlowSummary.qll +++ b/go/ql/lib/semmle/go/dataflow/FlowSummary.qll @@ -12,19 +12,9 @@ private import internal.DataFlowUtil // import all instances below private module Summaries { } -deprecated class SummaryComponent = Impl::Private::SummaryComponent; - -deprecated module SummaryComponent = Impl::Private::SummaryComponent; - -deprecated class SummaryComponentStack = Impl::Private::SummaryComponentStack; - -deprecated module SummaryComponentStack = Impl::Private::SummaryComponentStack; - /** Provides the `Range` class used to define the extent of `SummarizedCallable`. */ module SummarizedCallable { class Range = Impl::Public::SummarizedCallable; } class SummarizedCallable = Impl::Public::RelevantSummarizedCallable; - -deprecated class RequiredSummaryComponentStack = Impl::Private::RequiredSummaryComponentStack; diff --git a/go/ql/lib/semmle/go/dataflow/GlobalValueNumbering.qll b/go/ql/lib/semmle/go/dataflow/GlobalValueNumbering.qll index 6217aacae28b..8b56ad224c73 100644 --- a/go/ql/lib/semmle/go/dataflow/GlobalValueNumbering.qll +++ b/go/ql/lib/semmle/go/dataflow/GlobalValueNumbering.qll @@ -352,21 +352,6 @@ class GVN extends GvnBase { /** Gets the location of this element. */ Location getLocation() { result = this.exampleNode().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } } private predicate mkNumericConst(DataFlow::Node nd, string val) { diff --git a/go/ql/lib/semmle/go/dataflow/SSA.qll b/go/ql/lib/semmle/go/dataflow/SSA.qll index 57c9cb516f45..0138dddea976 100644 --- a/go/ql/lib/semmle/go/dataflow/SSA.qll +++ b/go/ql/lib/semmle/go/dataflow/SSA.qll @@ -115,17 +115,6 @@ deprecated class SsaVariable extends SsaDefinition { or this instanceof SsaPhiDefinition and result = "phi" } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } } /** @@ -279,21 +268,6 @@ class SsaWithFields extends TSsaWithFields { /** Gets the location of this SSA variable with fields. */ Location getLocation() { result = this.getBaseDefinition().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } } /** diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll index d3f965578c8d..b85a9e1a2599 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll @@ -149,21 +149,6 @@ module Public { /** Gets the location of this node. */ Location getLocation() { none() } - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } - /** Gets the file in which this node appears. */ File getFile() { result = this.getLocation().getFile() } diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll index fbbbe0172a9a..294e543387fc 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll @@ -331,21 +331,6 @@ class DataFlowCallable extends TDataFlowCallable { result = this.asFileScope().getLocation() or result = this.asSummarizedCallable().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this callable is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } } /** A function call relevant for data flow. */ diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll index c450244480ca..eb1ba0edeed5 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll @@ -176,28 +176,6 @@ class Content extends TContent { /** Gets the location of this element. */ Location getLocation() { none() } - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } - /** * Gets the `ContentSet` contaning only this content. */ @@ -300,28 +278,6 @@ class ContentSet instanceof TContentSet { */ Location getLocation() { result = this.asOneContent().getLocation() } - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - or - not exists(this.getLocation()) and - filepath = "" and - startline = 0 and - startcolumn = 0 and - endline = 0 and - endcolumn = 0 - } - /** * If this is a singleton content set, returns the content. */ diff --git a/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll b/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll index 4dc80eed652f..28b82adb11f7 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll @@ -264,15 +264,6 @@ module SourceSinkInterpretationInput implements result = this.asEntity().getLocation() or result = this.asAstNode().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - */ - deprecated predicate hasLocationInfo(string fp, int sl, int sc, int el, int ec) { - this.getLocation().hasLocationInfo(fp, sl, sc, el, ec) - } } private newtype TInterpretNode = @@ -324,15 +315,6 @@ module SourceSinkInterpretationInput implements result = this.asElement().getLocation() or result = this.asNode().getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Gets the location of this node. - */ - deprecated predicate hasLocationInfo(string fp, int sl, int sc, int el, int ec) { - this.getLocation().hasLocationInfo(fp, sl, sc, el, ec) - } } /** diff --git a/go/ql/lib/semmle/go/frameworks/Afero.qll b/go/ql/lib/semmle/go/frameworks/Afero.qll index 22704a6af8e5..758a6cd61d5b 100644 --- a/go/ql/lib/semmle/go/frameworks/Afero.qll +++ b/go/ql/lib/semmle/go/frameworks/Afero.qll @@ -16,42 +16,6 @@ module Afero { */ string aferoPackage() { result = package("github.com/spf13/afero", "") } - /** - * DEPRECATED: Use `FileSystemAccess::Range` instead. - * - * The File system access sinks of [afero](https://github.com/spf13/afero) framework methods - */ - deprecated class AferoSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode { - AferoSystemAccess() { - exists(Method m | - m.hasQualifiedName(aferoPackage(), "HttpFs", - ["Create", "Open", "OpenFile", "Remove", "RemoveAll"]) and - this = m.getACall() - or - m.hasQualifiedName(aferoPackage(), "RegexpFs", - ["Create", "Open", "OpenFile", "Remove", "RemoveAll", "Mkdir", "MkdirAll"]) and - this = m.getACall() - or - m.hasQualifiedName(aferoPackage(), "ReadOnlyFs", - ["Create", "Open", "OpenFile", "ReadDir", "ReadlinkIfPossible", "Mkdir", "MkdirAll"]) and - this = m.getACall() - or - m.hasQualifiedName(aferoPackage(), "OsFs", - [ - "Create", "Open", "OpenFile", "ReadlinkIfPossible", "Remove", "RemoveAll", "Mkdir", - "MkdirAll" - ]) and - this = m.getACall() - or - m.hasQualifiedName(aferoPackage(), "MemMapFs", - ["Create", "Open", "OpenFile", "Remove", "RemoveAll", "Mkdir", "MkdirAll"]) and - this = m.getACall() - ) - } - - override DataFlow::Node getAPathArgument() { result = this.getArgument(0) } - } - /** * The File system access sinks of [afero](https://github.com/spf13/afero) framework utility functions * diff --git a/go/ql/lib/semmle/go/frameworks/Couchbase.qll b/go/ql/lib/semmle/go/frameworks/Couchbase.qll deleted file mode 100644 index d1be1a73205e..000000000000 --- a/go/ql/lib/semmle/go/frameworks/Couchbase.qll +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Provides models of commonly used functions in the official Couchbase Go SDK library. - */ -overlay[local?] -module; - -import go - -/** - * DEPRECATED - * - * Provides models of commonly used functions in the official Couchbase Go SDK library. - */ -deprecated module Couchbase { - /** - * DEPRECATED - * - * Gets a package path for the official Couchbase Go SDK library. - * - * Note that v1 and v2 have different APIs, but the names are disjoint so there is no need to - * distinguish between them. - */ - deprecated string packagePath() { - result = - package([ - "gopkg.in/couchbase/gocb", "github.com/couchbase/gocb", "github.com/couchbaselabs/gocb" - ], "") - } -} diff --git a/go/ql/lib/semmle/go/frameworks/Echo.qll b/go/ql/lib/semmle/go/frameworks/Echo.qll index 865d8c3972b4..c6d229a1dc18 100644 --- a/go/ql/lib/semmle/go/frameworks/Echo.qll +++ b/go/ql/lib/semmle/go/frameworks/Echo.qll @@ -55,20 +55,4 @@ private module Echo { override DataFlow::Node getAContentTypeNode() { result = callNode.getArgument(1) } } - - /** - * DEPRECATED: Use `FileSystemAccess::Range` instead. - * - * The File system access sinks - */ - deprecated class FsOperations extends FileSystemAccess::Range, DataFlow::CallNode { - FsOperations() { - exists(Method m | - m.hasQualifiedName(packagePath(), "Context", ["Attachment", "File"]) and - this = m.getACall() - ) - } - - override DataFlow::Node getAPathArgument() { result = this.getArgument(0) } - } } diff --git a/go/ql/lib/semmle/go/frameworks/Fasthttp.qll b/go/ql/lib/semmle/go/frameworks/Fasthttp.qll index 75835d6a643a..81dd40ba89d8 100644 --- a/go/ql/lib/semmle/go/frameworks/Fasthttp.qll +++ b/go/ql/lib/semmle/go/frameworks/Fasthttp.qll @@ -176,26 +176,6 @@ module Fasthttp { * Provide models for sanitizer/Dangerous Functions of fasthttp. */ module Functions { - /** - * DEPRECATED: Use `FileSystemAccess::Range` instead. - * - * A function that doesn't sanitize user-provided file paths. - */ - deprecated class FileSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode { - FileSystemAccess() { - exists(Function f | - f.hasQualifiedName(packagePath(), - [ - "SaveMultipartFile", "ServeFile", "ServeFileBytes", "ServeFileBytesUncompressed", - "ServeFileUncompressed" - ]) and - this = f.getACall() - ) - } - - override DataFlow::Node getAPathArgument() { result = this.getArgument(1) } - } - /** * A function that can be used as a sanitizer for XSS. */ @@ -215,346 +195,5 @@ module Fasthttp { isHtmlEscape = false and result = "url" } } - - /** - * DEPRECATED: Use `RequestForgery::Sink` instead. - * - * A function that sends HTTP requests. - * - * Get* send a HTTP GET request. - * Post send a HTTP POST request. - * These functions first argument is a URL. - */ - deprecated class RequestForgerySink extends RequestForgery::Sink { - RequestForgerySink() { - exists(Function f | - f.hasQualifiedName(packagePath(), ["Get", "GetDeadline", "GetTimeout", "Post"]) and - this = f.getACall().getArgument(1) - ) - } - - override DataFlow::Node getARequest() { result = this } - - override string getKind() { result = "URL" } - } - - /** - * DEPRECATED: Use `RequestForgery::Sink` instead. - * - * A function that create initial connection to a TCP address. - * Following Functions only accept TCP address + Port in their first argument. - */ - deprecated class RequestForgerySinkDial extends RequestForgery::Sink { - RequestForgerySinkDial() { - exists(Function f | - f.hasQualifiedName(packagePath(), - ["Dial", "DialDualStack", "DialDualStackTimeout", "DialTimeout"]) and - this = f.getACall().getArgument(0) - ) - } - - override DataFlow::Node getARequest() { result = this } - - override string getKind() { result = "TCP Addr + Port" } - } - } - - /** - * DEPRECATED - * - * Provide modeling for fasthttp.URI Type. - */ - deprecated module URI { - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - */ - deprecated class UntrustedFlowSource = RemoteFlowSource; - - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - * - * The methods as Remote user controllable source which are part of the incoming URL. - */ - deprecated class RemoteFlowSource extends RemoteFlowSource::Range instanceof DataFlow::Node { - RemoteFlowSource() { - exists(Method m | - m.hasQualifiedName(packagePath(), "URI", - ["FullURI", "LastPathSegment", "Path", "PathOriginal", "QueryString", "String"]) and - this = m.getACall().getResult(0) - ) - } - } - } - - /** - * DEPRECATED - * - * Provide modeling for fasthttp.Args Type. - */ - deprecated module Args { - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - */ - deprecated class UntrustedFlowSource = RemoteFlowSource; - - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - * - * The methods as Remote user controllable source which are part of the incoming URL Parameters. - * - * When support for lambdas has been implemented we should model "VisitAll". - */ - deprecated class RemoteFlowSource extends RemoteFlowSource::Range instanceof DataFlow::Node { - RemoteFlowSource() { - exists(Method m | - m.hasQualifiedName(packagePath(), "Args", - ["Peek", "PeekBytes", "PeekMulti", "PeekMultiBytes", "QueryString", "String"]) and - this = m.getACall().getResult(0) - ) - } - } - } - - /** - * DEPRECATED - * - * Provide modeling for fasthttp.TCPDialer Type. - */ - deprecated module TcpDialer { - /** - * DEPRECATED: Use `RequestForgery::Sink` instead. - * - * A method that create initial connection to a TCP address. - * Provide Methods which can be used as dangerous RequestForgery Sinks. - * Following Methods only accept TCP address + Port in their first argument. - */ - deprecated class RequestForgerySinkDial extends RequestForgery::Sink { - RequestForgerySinkDial() { - exists(Method m | - m.hasQualifiedName(packagePath(), "TCPDialer", - ["Dial", "DialDualStack", "DialDualStackTimeout", "DialTimeout"]) and - this = m.getACall().getArgument(0) - ) - } - - override DataFlow::Node getARequest() { result = this } - - override string getKind() { result = "TCP Addr + Port" } - } - } - - /** - * DEPRECATED - * - * Provide modeling for fasthttp.Client Type. - */ - deprecated module Client { - /** - * DEPRECATED: Use `RequestForgery::Sink` instead. - * - * A method that sends HTTP requests. - * Get* send a HTTP GET request. - * Post send a HTTP POST request. - * these Functions first arguments is a URL. - */ - deprecated class RequestForgerySink extends RequestForgery::Sink { - RequestForgerySink() { - exists(Method m | - m.hasQualifiedName(packagePath(), "Client", ["Get", "GetDeadline", "GetTimeout", "Post"]) and - this = m.getACall().getArgument(1) - ) - } - - override DataFlow::Node getARequest() { result = this } - - override string getKind() { result = "URL" } - } - } - - /** - * DEPRECATED - * - * Provide modeling for fasthttp.HostClient Type. - */ - deprecated module HostClient { - /** - * DEPRECATED: Use `RequestForgery::Sink` instead. - * - * A method that sends HTTP requests. - * Get* send a HTTP GET request. - * Post send a HTTP POST request. - * these Functions first arguments is a URL. - */ - deprecated class RequestForgerySink extends RequestForgery::Sink { - RequestForgerySink() { - exists(Method m | - m.hasQualifiedName(packagePath(), "HostClient", - ["Get", "GetDeadline", "GetTimeout", "Post"]) and - this = m.getACall().getArgument(1) - ) - } - - override DataFlow::Node getARequest() { result = this } - - override string getKind() { result = "URL" } - } - } - - /** - * Provide modeling for fasthttp.Response Type. - */ - deprecated module Response { - /** - * DEPRECATED: Use `FileSystemAccess::Range` instead. - * - * A Method that sends files from its input. - * It does not check the input path against path traversal attacks, So it is a dangerous method. - */ - deprecated class FileSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode { - FileSystemAccess() { - exists(Method mcn | - mcn.hasQualifiedName(packagePath(), "Response", "SendFile") and - this = mcn.getACall() - ) - } - - override DataFlow::Node getAPathArgument() { result = this.getArgument(0) } - } - } - - /** - * Provide modeling for fasthttp.Request Type. - */ - module Request { - /** - * DEPRECATED: Use `RemoteFlowSource::range` instead. - */ - deprecated class UntrustedFlowSource = RemoteFlowSource; - - /** - * DEPRECATED: Use `RemoteFlowSource::range` instead. - * - * The methods as Remote user controllable source which can be many part of request. - */ - deprecated class RemoteFlowSource extends RemoteFlowSource::Range instanceof DataFlow::Node { - RemoteFlowSource() { - exists(Method m | - m.hasQualifiedName(packagePath(), "Request", - [ - "Body", "BodyGunzip", "BodyInflate", "BodyStream", "BodyUnbrotli", "BodyUncompressed", - "Host", "RequestURI" - ]) and - this = m.getACall().getResult(0) - ) - or - exists(Method m | - m.hasQualifiedName(packagePath(), "Request", - ["ReadBody", "ReadLimitBody", "ContinueReadBodyStream", "ContinueReadBody"]) and - this = m.getACall().getArgument(0) - ) - } - } - - /** - * DEPRECATED: Use `RequestForgery::Sink` instead. - * - * A method that create the URL and Host parts of a `Request` type. - * - * This instance of `Request` type can be used in some functions/methods - * like `func Do(req *Request, resp *Response) error` that will lead to server side request forgery vulnerability. - */ - deprecated class RequestForgerySink extends RequestForgery::Sink { - RequestForgerySink() { - exists(Method m | - m.hasQualifiedName(packagePath(), "Request", - ["SetHost", "SetHostBytes", "SetRequestURI", "SetRequestURIBytes", "SetURI"]) and - this = m.getACall().getArgument(0) - ) - } - - override DataFlow::Node getARequest() { result = this } - - override string getKind() { result = "URL" } - } - } - - /** - * Provide modeling for fasthttp.RequestCtx Type. - */ - module RequestCtx { - /** - * DEPRECATED: Use `FileSystemAccess::Range` instead. - * - * The Methods that don't sanitize user provided file paths. - */ - deprecated class FileSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode { - FileSystemAccess() { - exists(Method mcn | - mcn.hasQualifiedName(packagePath(), "RequestCtx", ["SendFile", "SendFileBytes"]) and - this = mcn.getACall() - ) - } - - override DataFlow::Node getAPathArgument() { result = this.getArgument(0) } - } - - /** - * DEPRECATED: Use `RemoteFlowSource` instead. - */ - deprecated class UntrustedFlowSource = RemoteFlowSource; - - /** - * DEPRECATED: Use `RemoteFlowSource` instead. - * - * The methods as Remote user controllable source which are generally related to HTTP request. - * - * When support for lambdas has been implemented we should model "VisitAll", "VisitAllCookie", "VisitAllInOrder", "VisitAllTrailer". - */ - deprecated class RemoteFlowSource extends RemoteFlowSource::Range instanceof DataFlow::Node { - RemoteFlowSource() { - exists(Method m | - m.hasQualifiedName(packagePath(), "RequestCtx", - [ - "Host", "Path", "PostBody", "Referer", "RequestBodyStream", "RequestURI", "String", - "UserAgent" - ]) and - this = m.getACall().getResult(0) - ) - } - } - } - - /** - * DEPRECATED - * - * Provide Methods of fasthttp.RequestHeader which mostly used as remote user controlled sources. - */ - deprecated module RequestHeader { - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - */ - deprecated class UntrustedFlowSource = RemoteFlowSource; - - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - * - * The methods as Remote user controllable source which are mostly related to HTTP Request Headers. - * - * When support for lambdas has been implemented we should model "VisitAll", "VisitAllCookie", "VisitAllInOrder", "VisitAllTrailer". - */ - deprecated class RemoteFlowSource extends RemoteFlowSource::Range instanceof DataFlow::Node { - RemoteFlowSource() { - exists(Method m | - m.hasQualifiedName(packagePath(), "RequestHeader", - [ - "ContentEncoding", "ContentType", "Cookie", "CookieBytes", "Header", "Host", - "MultipartFormBoundary", "Peek", "PeekAll", "PeekBytes", "PeekKeys", - "PeekTrailerKeys", "RawHeaders", "Referer", "RequestURI", "String", "TrailerHeader", - "UserAgent" - ]) and - this = m.getACall().getResult(0) - ) - } - } } } diff --git a/go/ql/lib/semmle/go/frameworks/GoMicro.qll b/go/ql/lib/semmle/go/frameworks/GoMicro.qll index 723f58899ffb..39cac2c25eb3 100644 --- a/go/ql/lib/semmle/go/frameworks/GoMicro.qll +++ b/go/ql/lib/semmle/go/frameworks/GoMicro.qll @@ -61,9 +61,6 @@ module GoMicro { */ override string getName() { result = definedType.getName() } - /** DEPRECATED: Use `getDefinedType` instead. */ - deprecated DefinedType getNamedType() { result = definedType } - /** * Gets the defined type on top of this interface type. */ diff --git a/go/ql/lib/semmle/go/frameworks/Mux.qll b/go/ql/lib/semmle/go/frameworks/Mux.qll deleted file mode 100644 index a4790e3c5cd7..000000000000 --- a/go/ql/lib/semmle/go/frameworks/Mux.qll +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Provides classes for working with concepts in the Mux HTTP middleware library. - */ -overlay[local?] -module; - -import go - -/** - * DEPRECATED - * - * Provides classes for working with concepts in the Mux HTTP middleware library. - */ -deprecated module Mux { - /** - * DEPRECATED: Use `RemoteFlowSource::Range` instead. - * - * An access to a Mux middleware variable. - */ - deprecated class RequestVars extends DataFlow::RemoteFlowSource::Range, DataFlow::CallNode { - RequestVars() { - this.getTarget().hasQualifiedName(package("github.com/gorilla/mux", ""), "Vars") - } - } -} diff --git a/go/ql/lib/semmle/go/frameworks/SQL.qll b/go/ql/lib/semmle/go/frameworks/SQL.qll index fad4722ad5cb..b232187c0ecc 100644 --- a/go/ql/lib/semmle/go/frameworks/SQL.qll +++ b/go/ql/lib/semmle/go/frameworks/SQL.qll @@ -205,10 +205,3 @@ module Xorm { } } } - -/** - * DEPRECATED - * - * Provides classes for working with the [Bun](https://bun.uptrace.dev/) package. - */ -deprecated module Bun { } diff --git a/go/ql/lib/semmle/go/frameworks/SystemCommandExecutors.qll b/go/ql/lib/semmle/go/frameworks/SystemCommandExecutors.qll index d1bbbf41d894..9e67174d2e03 100644 --- a/go/ql/lib/semmle/go/frameworks/SystemCommandExecutors.qll +++ b/go/ql/lib/semmle/go/frameworks/SystemCommandExecutors.qll @@ -43,21 +43,6 @@ private class ShellOrSudoExecution extends SystemCommandExecution::Range, DataFl } } -/** - * DEPRECATED - * - * Provides classes for working with the - * [golang.org/x/crypto/ssh](https://pkg.go.dev/golang.org/x/crypto/ssh) package. - */ -deprecated module CryptoSsh { - /** - * DEPRECATED: Use `package("golang.org/x/crypto", "ssh")` instead. - * - * Gets the package path `golang.org/x/crypto/ssh`. - */ - deprecated string packagePath() { result = package("golang.org/x/crypto", "ssh") } -} - /** * A data-flow node whose string value might refer to a command that interprets (some of) * its arguments as commands. diff --git a/go/ql/lib/semmle/go/frameworks/Twirp.qll b/go/ql/lib/semmle/go/frameworks/Twirp.qll index 2fcd44da2ff8..e8dc9f0162ba 100644 --- a/go/ql/lib/semmle/go/frameworks/Twirp.qll +++ b/go/ql/lib/semmle/go/frameworks/Twirp.qll @@ -54,9 +54,6 @@ module Twirp { /** Gets the name of the interface. */ override string getName() { result = definedType.getName() } - /** DEPRECATED: Use `getDefinedType` instead. */ - deprecated DefinedType getNamedType() { result = this.getDefinedType() } - /** Gets the defined type on top of this interface type. */ DefinedType getDefinedType() { result = definedType } } diff --git a/go/ql/lib/semmle/go/frameworks/WebSocket.qll b/go/ql/lib/semmle/go/frameworks/WebSocket.qll index e8657d296b3f..2abf648d7e6a 100644 --- a/go/ql/lib/semmle/go/frameworks/WebSocket.qll +++ b/go/ql/lib/semmle/go/frameworks/WebSocket.qll @@ -126,17 +126,6 @@ module WebSocketRequestCall { } } -/** - * DEPRECATED: Use `WebSocketReader` or `RemoteFlowSource::Range` instead. - * - * A message written to a WebSocket, considered as a flow sink for reflected XSS. - */ -deprecated class WebSocketReaderAsSource extends RemoteFlowSource::Range { - WebSocketReaderAsSource() { - exists(WebSocketReader r | this = r.getAnOutput().getNode(r.getACall())) - } -} - /** * A function or a method which reads a message from a WebSocket connection. * diff --git a/go/ql/lib/semmle/go/frameworks/XPath.qll b/go/ql/lib/semmle/go/frameworks/XPath.qll index d052a619c35c..4d237d29df2b 100644 --- a/go/ql/lib/semmle/go/frameworks/XPath.qll +++ b/go/ql/lib/semmle/go/frameworks/XPath.qll @@ -39,24 +39,3 @@ module XPath { ExternalSanitizer() { barrierNode(this, "xpath-injection") } } } - -/** - * DEPRECATED - * - * Provides classes for working with the [xmlpath](https://gopkg.in/xmlpath.v2) package. - */ -deprecated module XmlPath { - /** - * DEPRECATED - * - * Gets the package name `github.com/go-xmlpath/xmlpath` or `gopkg.in/xmlpath`. - */ - deprecated string packagePath() { - result = - package([ - "github.com/go-xmlpath/xmlpath", "gopkg.in/xmlpath", "github.com/crankycoder/xmlpath", - "launchpad.net/xmlpath", "github.com/masterzen/xmlpath", - "github.com/going/toolkit/xmlpath", "gopkg.in/go-xmlpath/xmlpath" - ], "") - } -} diff --git a/go/ql/lib/semmle/go/frameworks/stdlib/Fmt.qll b/go/ql/lib/semmle/go/frameworks/stdlib/Fmt.qll index bc58441ada91..3a596bd9e770 100644 --- a/go/ql/lib/semmle/go/frameworks/stdlib/Fmt.qll +++ b/go/ql/lib/semmle/go/frameworks/stdlib/Fmt.qll @@ -9,22 +9,6 @@ import go // Some TaintTracking::FunctionModel subclasses remain because varargs functions don't work with Models-as-Data sumamries yet. /** Provides models of commonly used functions in the `fmt` package. */ module Fmt { - /** - * DEPRECATED: Use AppenderOrSprinterFunc instead. - * - * The `Sprint` or `Append` functions or one of their variants. - */ - deprecated class AppenderOrSprinter extends TaintTracking::FunctionModel { - AppenderOrSprinter() { - this.hasQualifiedName("fmt", - ["Append", "Appendf", "Appendln", "Sprint", "Sprintf", "Sprintln"]) - } - - override predicate hasTaintFlow(FunctionInput inp, FunctionOutput outp) { - inp.isParameter(_) and outp.isResult() - } - } - /** The `Sprint` or `Append` functions or one of their variants. */ class AppenderOrSprinterFunc extends Function { AppenderOrSprinterFunc() { diff --git a/go/ql/lib/semmle/go/frameworks/stdlib/HtmlTemplate.qll b/go/ql/lib/semmle/go/frameworks/stdlib/HtmlTemplate.qll index 8d343bfa4fec..412aa17d2cee 100644 --- a/go/ql/lib/semmle/go/frameworks/stdlib/HtmlTemplate.qll +++ b/go/ql/lib/semmle/go/frameworks/stdlib/HtmlTemplate.qll @@ -78,21 +78,6 @@ module HtmlTemplate { /** Gets the location of this template statement. */ Location getLocation() { result = parent.getLocation() } - - /** - * DEPRECATED: Use `getLocation()` instead. - * - * Holds if this element is at the specified location. - * The location spans column `startcolumn` of line `startline` to - * column `endcolumn` of line `endline` in file `filepath`. - * For more information, see - * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/). - */ - deprecated predicate hasLocationInfo( - string filepath, int startline, int startcolumn, int endline, int endcolumn - ) { - this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) - } } private newtype TTemplateRead = diff --git a/go/ql/lib/semmle/go/frameworks/stdlib/NetHttp.qll b/go/ql/lib/semmle/go/frameworks/stdlib/NetHttp.qll index 662c39d6de89..2c2df4e39203 100644 --- a/go/ql/lib/semmle/go/frameworks/stdlib/NetHttp.qll +++ b/go/ql/lib/semmle/go/frameworks/stdlib/NetHttp.qll @@ -280,22 +280,6 @@ module NetHttp { override predicate guardedBy(DataFlow::Node check) { check = handlerReg.getArgument(0) } } - /** - * DEPRECATED: Use `FileSystemAccess::Range` instead. - * - * The File system access sinks - */ - deprecated class HttpServeFile extends FileSystemAccess::Range, DataFlow::CallNode { - HttpServeFile() { - exists(Function f | - f.hasQualifiedName("net/http", "ServeFile") and - this = f.getACall() - ) - } - - override DataFlow::Node getAPathArgument() { result = this.getArgument(2) } - } - private class CookieWrite extends Http::CookieWrite::Range, DataFlow::CallNode { CookieWrite() { this.getTarget().hasQualifiedName(package("net/http", ""), "SetCookie") } diff --git a/go/ql/lib/semmle/go/security/CommandInjectionCustomizations.qll b/go/ql/lib/semmle/go/security/CommandInjectionCustomizations.qll index bc42a5e59f02..bcf7c1e9089a 100644 --- a/go/ql/lib/semmle/go/security/CommandInjectionCustomizations.qll +++ b/go/ql/lib/semmle/go/security/CommandInjectionCustomizations.qll @@ -30,11 +30,6 @@ module CommandInjection { */ abstract class Sanitizer extends DataFlow::Node { } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** A source of untrusted data, considered as a taint source for command injection. */ private class ThreatModelFlowAsSource extends Source instanceof ActiveThreatModelSource { } diff --git a/go/ql/lib/semmle/go/security/FlowSources.qll b/go/ql/lib/semmle/go/security/FlowSources.qll index 258f924b6fb2..249abb763032 100644 --- a/go/ql/lib/semmle/go/security/FlowSources.qll +++ b/go/ql/lib/semmle/go/security/FlowSources.qll @@ -6,11 +6,6 @@ import go private import semmle.go.dataflow.ExternalFlow as ExternalFlow private import codeql.threatmodels.ThreatModels -/** - * DEPRECATED: Use `RemoteFlowSource` instead. - */ -deprecated class UntrustedFlowSource = RemoteFlowSource; - /** * A source of data that is controlled by an untrusted user. * @@ -19,11 +14,6 @@ deprecated class UntrustedFlowSource = RemoteFlowSource; */ class RemoteFlowSource extends DataFlow::Node instanceof RemoteFlowSource::Range { } -/** - * DEPRECATED: Use `RemoteFlowSource` instead. - */ -deprecated module UntrustedFlowSource = RemoteFlowSource; - /** Provides a class for modeling new sources of untrusted data. */ module RemoteFlowSource { /** @@ -54,14 +44,6 @@ abstract class SourceNode extends DataFlow::Node { abstract string getThreatModel(); } -/** - * DEPRECATED: Use `ActiveThreatModelSource` instead. - * - * A class of data flow sources that respects the - * current threat model configuration. - */ -deprecated class ThreatModelFlowSource = ActiveThreatModelSource; - /** * A data flow source that is enabled in the current threat model configuration. */ diff --git a/go/ql/lib/semmle/go/security/LogInjectionCustomizations.qll b/go/ql/lib/semmle/go/security/LogInjectionCustomizations.qll index 9160c204df1d..ce00b2d1e98a 100644 --- a/go/ql/lib/semmle/go/security/LogInjectionCustomizations.qll +++ b/go/ql/lib/semmle/go/security/LogInjectionCustomizations.qll @@ -25,11 +25,6 @@ module LogInjection { */ abstract class Sanitizer extends DataFlow::Node { } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** A source of untrusted data, considered as a taint source for log injection. */ private class ThreatModelFlowAsSource extends Source instanceof ActiveThreatModelSource { } diff --git a/go/ql/lib/semmle/go/security/OpenUrlRedirectCustomizations.qll b/go/ql/lib/semmle/go/security/OpenUrlRedirectCustomizations.qll index 1b5e2d7eb007..05e4670b5c8e 100644 --- a/go/ql/lib/semmle/go/security/OpenUrlRedirectCustomizations.qll +++ b/go/ql/lib/semmle/go/security/OpenUrlRedirectCustomizations.qll @@ -42,11 +42,6 @@ module OpenUrlRedirect { abstract predicate hasTaintStep(DataFlow::Node pred, DataFlow::Node succ); } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** * A source of third-party user input, considered as a flow source for URL redirects. */ diff --git a/go/ql/lib/semmle/go/security/ReflectedXssCustomizations.qll b/go/ql/lib/semmle/go/security/ReflectedXssCustomizations.qll index 47e823708304..f89b68d5ad93 100644 --- a/go/ql/lib/semmle/go/security/ReflectedXssCustomizations.qll +++ b/go/ql/lib/semmle/go/security/ReflectedXssCustomizations.qll @@ -34,11 +34,6 @@ module ReflectedXss { } } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** * A third-party controllable input, considered as a flow source for reflected XSS. */ diff --git a/go/ql/lib/semmle/go/security/RequestForgeryCustomizations.qll b/go/ql/lib/semmle/go/security/RequestForgeryCustomizations.qll index 83224cefc4c4..c7081f34451d 100644 --- a/go/ql/lib/semmle/go/security/RequestForgeryCustomizations.qll +++ b/go/ql/lib/semmle/go/security/RequestForgeryCustomizations.qll @@ -34,11 +34,6 @@ module RequestForgery { /** An outgoing sanitizer edge for request forgery vulnerabilities. */ abstract class SanitizerEdge extends DataFlow::Node { } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** * A third-party controllable input, considered as a flow source for request forgery. */ diff --git a/go/ql/lib/semmle/go/security/SqlInjectionCustomizations.qll b/go/ql/lib/semmle/go/security/SqlInjectionCustomizations.qll index 5d813bcbdacf..5aa612a61e2a 100644 --- a/go/ql/lib/semmle/go/security/SqlInjectionCustomizations.qll +++ b/go/ql/lib/semmle/go/security/SqlInjectionCustomizations.qll @@ -26,11 +26,6 @@ module SqlInjection { */ abstract class Sanitizer extends DataFlow::Node { } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** A source of untrusted data, considered as a taint source for SQL injection. */ private class ThreatModelFlowAsSource extends Source instanceof ActiveThreatModelSource { } diff --git a/go/ql/lib/semmle/go/security/TaintedPathCustomizations.qll b/go/ql/lib/semmle/go/security/TaintedPathCustomizations.qll index d49365537373..54997614d077 100644 --- a/go/ql/lib/semmle/go/security/TaintedPathCustomizations.qll +++ b/go/ql/lib/semmle/go/security/TaintedPathCustomizations.qll @@ -44,11 +44,6 @@ module TaintedPath { } } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** A source of untrusted data, considered as a taint source for path traversal. */ private class ThreatModelFlowAsSource extends Source instanceof ActiveThreatModelSource { } diff --git a/go/ql/lib/semmle/go/security/XPathInjectionCustomizations.qll b/go/ql/lib/semmle/go/security/XPathInjectionCustomizations.qll index baf4706e8639..2c56af871455 100644 --- a/go/ql/lib/semmle/go/security/XPathInjectionCustomizations.qll +++ b/go/ql/lib/semmle/go/security/XPathInjectionCustomizations.qll @@ -24,11 +24,6 @@ module XPathInjection { */ abstract class Sanitizer extends DataFlow::ExprNode { } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowAsSource = ThreatModelFlowAsSource; - /** A source of untrusted data, used in an XPath expression. */ private class ThreatModelFlowAsSource extends Source instanceof ActiveThreatModelSource { } diff --git a/go/ql/src/Security/CWE-640/EmailInjectionCustomizations.qll b/go/ql/src/Security/CWE-640/EmailInjectionCustomizations.qll index 92ae2bc92095..ae86cbdfb026 100644 --- a/go/ql/src/Security/CWE-640/EmailInjectionCustomizations.qll +++ b/go/ql/src/Security/CWE-640/EmailInjectionCustomizations.qll @@ -16,11 +16,6 @@ module EmailInjection { */ abstract class Sink extends DataFlow::Node { } - /** - * DEPRECATED: Use `ActiveThreatModelSource` or `Source` instead. - */ - deprecated class UntrustedFlowSourceAsSource = ThreatModelFlowAsSource; - /** A source of untrusted data, considered as a taint source for email injection. */ private class ThreatModelFlowAsSource extends Source instanceof ActiveThreatModelSource { } diff --git a/go/ql/src/change-notes/2026-11-18-outdated-deprecations.md b/go/ql/src/change-notes/2026-11-18-outdated-deprecations.md new file mode 100644 index 000000000000..c234af6df7d0 --- /dev/null +++ b/go/ql/src/change-notes/2026-11-18-outdated-deprecations.md @@ -0,0 +1,4 @@ +--- +category: breaking +--- +* Removed the deprecated `UntrustedFlowSourceAsSource` alias in the email-injection customizations. Use `ActiveThreatModelSource` or `EmailInjection::Source` instead. diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go b/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go index edfc960b59f4..1c3b923f9122 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go +++ b/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go @@ -20,11 +20,11 @@ func Afero(writer http.ResponseWriter, request *http.Request) { //osFS := afero.NewMemMapFs() // OR osFS := afero.NewOsFs() - fmt.Println(osFS.MkdirAll(filepath, 0755)) // $ FileSystemAccess=filepath + fmt.Println(osFS.MkdirAll(filepath, 0755)) fmt.Println(afero.WriteFile(osFS, filepath, []byte("this is me a !"), 0755)) // $ FileSystemAccess=filepath content, _ := afero.ReadFile(osFS, filepath) // $ FileSystemAccess=filepath fmt.Println(string(content)) - fmt.Println(osFS.Open(filepath)) // $ FileSystemAccess=filepath + fmt.Println(osFS.Open(filepath)) // NOT OK fmt.Println(afero.SafeWriteReader(osFS, filepath, os.Stdout)) // $ FileSystemAccess=filepath fmt.Println(afero.WriteReader(osFS, filepath, os.Stdout)) // $ FileSystemAccess=filepath diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Fasthttp/fasthttp.go b/go/ql/test/library-tests/semmle/go/frameworks/Fasthttp/fasthttp.go index 061f50355d54..fe8cc4e2e532 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/Fasthttp/fasthttp.go +++ b/go/ql/test/library-tests/semmle/go/frameworks/Fasthttp/fasthttp.go @@ -169,10 +169,10 @@ func fasthttpServer() { fmt.Println(body1, body2, body3, body4) requestCtx.Request.BodyStream() // $ RemoteFlowSource="call to BodyStream" - requestCtx.Request.ReadBody(&bufio.Reader{}, 100, 1000) // $ RemoteFlowSource="&..." RemoteFlowSource="&... [postupdate]" - requestCtx.Request.ReadLimitBody(&bufio.Reader{}, 100) // $ RemoteFlowSource="&..." RemoteFlowSource="&... [postupdate]" - requestCtx.Request.ContinueReadBodyStream(&bufio.Reader{}, 100, true) // $ RemoteFlowSource="&..." RemoteFlowSource="&... [postupdate]" - requestCtx.Request.ContinueReadBody(&bufio.Reader{}, 100) // $ RemoteFlowSource="&..." RemoteFlowSource="&... [postupdate]" + requestCtx.Request.ReadBody(&bufio.Reader{}, 100, 1000) // $ RemoteFlowSource="&... [postupdate]" + requestCtx.Request.ReadLimitBody(&bufio.Reader{}, 100) // $ RemoteFlowSource="&... [postupdate]" + requestCtx.Request.ContinueReadBodyStream(&bufio.Reader{}, 100, true) // $ RemoteFlowSource="&... [postupdate]" + requestCtx.Request.ContinueReadBody(&bufio.Reader{}, 100) // $ RemoteFlowSource="&... [postupdate]" // Response methods // Xss Sinks Related method From 96e3646d5f1af5ba484e213a57ab7060a9019b59 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema <93738568+jketema@users.noreply.github.com> Date: Fri, 20 Nov 2026 16:21:36 +0000 Subject: [PATCH 2/3] Go: Update expectations after removing deprecated fmt model Regenerate test expectations to remove obsolete FunctionModel provenance and direct local-taint edges. Preserve expected alerts, sources, and sinks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c467897f-62f7-4d80-8def-3a2f24c8763c --- go/ql/test/experimental/CWE-74/DsnInjection.expected | 1 - .../experimental/CWE-74/DsnInjectionLocal.expected | 2 -- go/ql/test/experimental/CWE-918/SSRF.expected | 6 ------ .../go/dataflow/FlowSteps/LocalTaintStep.expected | 4 ---- .../Security/CWE-078/CommandInjection.expected | 2 -- .../query-tests/Security/CWE-079/ReflectedXss.expected | 7 +------ .../query-tests/Security/CWE-089/SqlInjection.expected | 10 ---------- .../InsecureRandomness/InsecureRandomness.expected | 1 - 8 files changed, 1 insertion(+), 32 deletions(-) diff --git a/go/ql/test/experimental/CWE-74/DsnInjection.expected b/go/ql/test/experimental/CWE-74/DsnInjection.expected index e1f66aa14139..3a47f3698882 100644 --- a/go/ql/test/experimental/CWE-74/DsnInjection.expected +++ b/go/ql/test/experimental/CWE-74/DsnInjection.expected @@ -5,7 +5,6 @@ edges | Dsn.go:49:11:49:106 | []type{args} [array] | Dsn.go:49:11:49:106 | call to Sprintf | provenance | MaD:2 | | Dsn.go:49:11:49:106 | call to Sprintf | Dsn.go:50:29:50:33 | dbDSN | provenance | | | Dsn.go:49:102:49:105 | name | Dsn.go:49:11:49:106 | []type{args} [array] | provenance | | -| Dsn.go:49:102:49:105 | name | Dsn.go:49:11:49:106 | call to Sprintf | provenance | FunctionModel | models | 1 | Source: net/http; Request; true; FormValue; ; ; ReturnValue; remote; manual | | 2 | Summary: fmt; ; false; Sprintf; ; ; Argument[1].ArrayElement; ReturnValue; taint; manual | diff --git a/go/ql/test/experimental/CWE-74/DsnInjectionLocal.expected b/go/ql/test/experimental/CWE-74/DsnInjectionLocal.expected index 1a938af237c2..8ce03443b055 100644 --- a/go/ql/test/experimental/CWE-74/DsnInjectionLocal.expected +++ b/go/ql/test/experimental/CWE-74/DsnInjectionLocal.expected @@ -6,7 +6,6 @@ edges | Dsn.go:28:11:28:110 | []type{args} [array] | Dsn.go:28:11:28:110 | call to Sprintf | provenance | MaD:2 | | Dsn.go:28:11:28:110 | call to Sprintf | Dsn.go:29:29:29:33 | dbDSN | provenance | | | Dsn.go:28:102:28:109 | index expression | Dsn.go:28:11:28:110 | []type{args} [array] | provenance | | -| Dsn.go:28:102:28:109 | index expression | Dsn.go:28:11:28:110 | call to Sprintf | provenance | FunctionModel | | Dsn.go:63:9:63:11 | cfg [postupdate] [pointer] | Dsn.go:67:102:67:104 | cfg [pointer] | provenance | | | Dsn.go:63:9:63:11 | implicit-deref cfg [postupdate] | Dsn.go:63:9:63:11 | cfg [postupdate] [pointer] | provenance | | | Dsn.go:63:9:63:11 | implicit-deref cfg [postupdate] | Dsn.go:67:102:67:108 | selection of dsn | provenance | | @@ -17,7 +16,6 @@ edges | Dsn.go:67:102:67:104 | cfg [pointer] | Dsn.go:67:102:67:104 | implicit-deref cfg | provenance | | | Dsn.go:67:102:67:104 | implicit-deref cfg | Dsn.go:67:102:67:108 | selection of dsn | provenance | | | Dsn.go:67:102:67:108 | selection of dsn | Dsn.go:67:11:67:109 | []type{args} [array] | provenance | | -| Dsn.go:67:102:67:108 | selection of dsn | Dsn.go:67:11:67:109 | call to Sprintf | provenance | FunctionModel | models | 1 | Source: os; ; false; Args; ; ; ; commandargs; manual | | 2 | Summary: fmt; ; false; Sprintf; ; ; Argument[1].ArrayElement; ReturnValue; taint; manual | diff --git a/go/ql/test/experimental/CWE-918/SSRF.expected b/go/ql/test/experimental/CWE-918/SSRF.expected index 28f5e2ca18bf..830ed91fc7a5 100644 --- a/go/ql/test/experimental/CWE-918/SSRF.expected +++ b/go/ql/test/experimental/CWE-918/SSRF.expected @@ -34,13 +34,10 @@ edges | new-tests.go:26:26:26:30 | &... [postupdate] | new-tests.go:35:49:35:57 | selection of word | provenance | Src:MaD:3 | | new-tests.go:31:11:31:57 | []type{args} [array] | new-tests.go:31:11:31:57 | call to Sprintf | provenance | MaD:11 | | new-tests.go:31:48:31:56 | selection of word | new-tests.go:31:11:31:57 | []type{args} [array] | provenance | | -| new-tests.go:31:48:31:56 | selection of word | new-tests.go:31:11:31:57 | call to Sprintf | provenance | FunctionModel | | new-tests.go:32:11:32:57 | []type{args} [array] | new-tests.go:32:11:32:57 | call to Sprintf | provenance | MaD:11 | | new-tests.go:32:48:32:56 | selection of safe | new-tests.go:32:11:32:57 | []type{args} [array] | provenance | | -| new-tests.go:32:48:32:56 | selection of safe | new-tests.go:32:11:32:57 | call to Sprintf | provenance | FunctionModel | | new-tests.go:35:12:35:58 | []type{args} [array] | new-tests.go:35:12:35:58 | call to Sprintf | provenance | MaD:11 | | new-tests.go:35:49:35:57 | selection of word | new-tests.go:35:12:35:58 | []type{args} [array] | provenance | | -| new-tests.go:35:49:35:57 | selection of word | new-tests.go:35:12:35:58 | call to Sprintf | provenance | FunctionModel | | new-tests.go:39:18:39:30 | call to Param | new-tests.go:47:11:47:46 | ...+... | provenance | Src:MaD:1 | | new-tests.go:49:18:49:30 | call to Query | new-tests.go:50:11:50:46 | ...+... | provenance | Src:MaD:2 | | new-tests.go:62:2:62:39 | extract:0 ... := ... | new-tests.go:63:17:63:23 | reqBody | provenance | | @@ -51,13 +48,10 @@ edges | new-tests.go:63:26:63:30 | &... [postupdate] | new-tests.go:74:49:74:57 | selection of word | provenance | | | new-tests.go:68:11:68:57 | []type{args} [array] | new-tests.go:68:11:68:57 | call to Sprintf | provenance | MaD:11 | | new-tests.go:68:48:68:56 | selection of word | new-tests.go:68:11:68:57 | []type{args} [array] | provenance | | -| new-tests.go:68:48:68:56 | selection of word | new-tests.go:68:11:68:57 | call to Sprintf | provenance | FunctionModel | | new-tests.go:69:11:69:57 | []type{args} [array] | new-tests.go:69:11:69:57 | call to Sprintf | provenance | MaD:11 | | new-tests.go:69:48:69:56 | selection of safe | new-tests.go:69:11:69:57 | []type{args} [array] | provenance | | -| new-tests.go:69:48:69:56 | selection of safe | new-tests.go:69:11:69:57 | call to Sprintf | provenance | FunctionModel | | new-tests.go:74:12:74:58 | []type{args} [array] | new-tests.go:74:12:74:58 | call to Sprintf | provenance | MaD:11 | | new-tests.go:74:49:74:57 | selection of word | new-tests.go:74:12:74:58 | []type{args} [array] | provenance | | -| new-tests.go:74:49:74:57 | selection of word | new-tests.go:74:12:74:58 | call to Sprintf | provenance | FunctionModel | | new-tests.go:78:18:78:24 | selection of URL | new-tests.go:78:18:78:32 | call to Query | provenance | Src:MaD:9 MaD:14 | | new-tests.go:78:18:78:32 | call to Query | new-tests.go:78:18:78:46 | call to Get | provenance | MaD:15 | | new-tests.go:78:18:78:46 | call to Get | new-tests.go:79:11:79:46 | ...+... | provenance | | diff --git a/go/ql/test/library-tests/semmle/go/dataflow/FlowSteps/LocalTaintStep.expected b/go/ql/test/library-tests/semmle/go/dataflow/FlowSteps/LocalTaintStep.expected index 4ace99a0ab2c..91665c49cdcf 100644 --- a/go/ql/test/library-tests/semmle/go/dataflow/FlowSteps/LocalTaintStep.expected +++ b/go/ql/test/library-tests/semmle/go/dataflow/FlowSteps/LocalTaintStep.expected @@ -17,13 +17,9 @@ | strings.go:10:35:10:41 | "&" | strings.go:10:8:10:42 | call to ReplaceAll | | strings.go:11:9:11:26 | call to Sprint | strings.go:11:9:11:50 | ...+... | | strings.go:11:9:11:50 | ...+... | strings.go:11:9:11:69 | ...+... | -| strings.go:11:20:11:21 | s2 | strings.go:11:9:11:26 | call to Sprint | -| strings.go:11:24:11:25 | s3 | strings.go:11:9:11:26 | call to Sprint | | strings.go:11:30:11:50 | call to Sprintf | strings.go:11:9:11:50 | ...+... | | strings.go:11:42:11:45 | "%q" | strings.go:11:30:11:50 | call to Sprintf | -| strings.go:11:48:11:49 | s2 | strings.go:11:30:11:50 | call to Sprintf | | strings.go:11:54:11:69 | call to Sprintln | strings.go:11:9:11:69 | ...+... | -| strings.go:11:67:11:68 | s3 | strings.go:11:54:11:69 | call to Sprintln | | url.go:12:14:12:48 | call to PathUnescape | url.go:12:3:12:48 | extract:0 ... = ... | | url.go:12:14:12:48 | call to PathUnescape | url.go:12:3:12:48 | extract:1 ... = ... | | url.go:12:31:12:47 | call to PathEscape | url.go:12:3:12:48 | extract:0 ... = ... | diff --git a/go/ql/test/query-tests/Security/CWE-078/CommandInjection.expected b/go/ql/test/query-tests/Security/CWE-078/CommandInjection.expected index 2c0e30f02e47..8f6faa812bc2 100644 --- a/go/ql/test/query-tests/Security/CWE-078/CommandInjection.expected +++ b/go/ql/test/query-tests/Security/CWE-078/CommandInjection.expected @@ -32,12 +32,10 @@ edges | CommandInjection2.go:13:15:13:29 | call to Query | CommandInjection2.go:15:67:15:75 | imageName | provenance | | | CommandInjection2.go:15:34:15:88 | []type{args} [array] | CommandInjection2.go:15:34:15:88 | call to Sprintf | provenance | MaD:6 | | CommandInjection2.go:15:67:15:75 | imageName | CommandInjection2.go:15:34:15:88 | []type{args} [array] | provenance | | -| CommandInjection2.go:15:67:15:75 | imageName | CommandInjection2.go:15:34:15:88 | call to Sprintf | provenance | FunctionModel | | CommandInjection2.go:41:15:41:21 | selection of URL | CommandInjection2.go:41:15:41:29 | call to Query | provenance | Src:MaD:2 MaD:7 | | CommandInjection2.go:41:15:41:29 | call to Query | CommandInjection2.go:44:67:44:75 | imageName | provenance | | | CommandInjection2.go:44:34:44:88 | []type{args} [array] | CommandInjection2.go:44:34:44:88 | call to Sprintf | provenance | MaD:6 | | CommandInjection2.go:44:67:44:75 | imageName | CommandInjection2.go:44:34:44:88 | []type{args} [array] | provenance | | -| CommandInjection2.go:44:67:44:75 | imageName | CommandInjection2.go:44:34:44:88 | call to Sprintf | provenance | FunctionModel | | CommandInjection.go:9:13:9:19 | selection of URL | CommandInjection.go:9:13:9:27 | call to Query | provenance | Src:MaD:2 MaD:7 | | CommandInjection.go:9:13:9:27 | call to Query | CommandInjection.go:10:22:10:28 | cmdName | provenance | Sink:MaD:1 | | GitSubcommands.go:11:13:11:19 | selection of URL | GitSubcommands.go:11:13:11:27 | call to Query | provenance | Src:MaD:2 MaD:7 | diff --git a/go/ql/test/query-tests/Security/CWE-079/ReflectedXss.expected b/go/ql/test/query-tests/Security/CWE-079/ReflectedXss.expected index 48b7d7728df6..0cd98c28f871 100644 --- a/go/ql/test/query-tests/Security/CWE-079/ReflectedXss.expected +++ b/go/ql/test/query-tests/Security/CWE-079/ReflectedXss.expected @@ -33,17 +33,14 @@ edges | contenttype.go:113:10:113:28 | call to FormValue | contenttype.go:114:50:114:53 | data | provenance | Src:MaD:9 | | reflectedxsstest.go:30:2:30:44 | extract:0 ... := ... | reflectedxsstest.go:31:30:31:33 | file | provenance | Src:MaD:8 | | reflectedxsstest.go:30:2:30:44 | extract:1 ... := ... | reflectedxsstest.go:34:46:34:60 | selection of Filename | provenance | Src:MaD:8 | -| reflectedxsstest.go:31:2:31:34 | extract:0 ... := ... | reflectedxsstest.go:32:48:32:54 | content | provenance | | +| reflectedxsstest.go:31:2:31:34 | extract:0 ... := ... | reflectedxsstest.go:33:49:33:55 | content | provenance | | | reflectedxsstest.go:31:30:31:33 | file | reflectedxsstest.go:31:2:31:34 | extract:0 ... := ... | provenance | MaD:13 | -| reflectedxsstest.go:32:48:32:54 | content | reflectedxsstest.go:33:49:33:55 | content | provenance | | | reflectedxsstest.go:33:17:33:56 | []type{args} [array] | reflectedxsstest.go:33:17:33:56 | call to Sprintf | provenance | MaD:12 | | reflectedxsstest.go:33:17:33:56 | call to Sprintf | reflectedxsstest.go:33:10:33:57 | type conversion | provenance | | | reflectedxsstest.go:33:49:33:55 | content | reflectedxsstest.go:33:17:33:56 | []type{args} [array] | provenance | | -| reflectedxsstest.go:33:49:33:55 | content | reflectedxsstest.go:33:17:33:56 | call to Sprintf | provenance | FunctionModel | | reflectedxsstest.go:34:17:34:61 | []type{args} [array] | reflectedxsstest.go:34:17:34:61 | call to Sprintf | provenance | MaD:12 | | reflectedxsstest.go:34:17:34:61 | call to Sprintf | reflectedxsstest.go:34:10:34:62 | type conversion | provenance | | | reflectedxsstest.go:34:46:34:60 | selection of Filename | reflectedxsstest.go:34:17:34:61 | []type{args} [array] | provenance | | -| reflectedxsstest.go:34:46:34:60 | selection of Filename | reflectedxsstest.go:34:17:34:61 | call to Sprintf | provenance | FunctionModel | | reflectedxsstest.go:38:2:38:35 | extract:0 ... := ... | reflectedxsstest.go:39:16:39:21 | reader | provenance | Src:MaD:10 | | reflectedxsstest.go:39:2:39:32 | extract:0 ... := ... | reflectedxsstest.go:40:14:40:17 | part | provenance | | | reflectedxsstest.go:39:2:39:32 | extract:0 ... := ... | reflectedxsstest.go:42:2:42:5 | part | provenance | | @@ -55,7 +52,6 @@ edges | reflectedxsstest.go:44:17:44:54 | []type{args} [array] | reflectedxsstest.go:44:17:44:54 | call to Sprintf | provenance | MaD:12 | | reflectedxsstest.go:44:17:44:54 | call to Sprintf | reflectedxsstest.go:44:10:44:55 | type conversion | provenance | | | reflectedxsstest.go:44:46:44:53 | partName | reflectedxsstest.go:44:17:44:54 | []type{args} [array] | provenance | | -| reflectedxsstest.go:44:46:44:53 | partName | reflectedxsstest.go:44:17:44:54 | call to Sprintf | provenance | FunctionModel | | reflectedxsstest.go:51:14:51:18 | selection of URL | reflectedxsstest.go:51:14:51:26 | call to Query | provenance | Src:MaD:11 MaD:17 | | reflectedxsstest.go:51:14:51:26 | call to Query | reflectedxsstest.go:54:11:54:21 | type conversion | provenance | | | tst.go:14:15:14:20 | selection of Form | tst.go:14:15:14:36 | call to Get | provenance | Src:MaD:7 MaD:18 | @@ -115,7 +111,6 @@ nodes | reflectedxsstest.go:30:2:30:44 | extract:1 ... := ... | semmle.label | extract:1 ... := ... | | reflectedxsstest.go:31:2:31:34 | extract:0 ... := ... | semmle.label | extract:0 ... := ... | | reflectedxsstest.go:31:30:31:33 | file | semmle.label | file | -| reflectedxsstest.go:32:48:32:54 | content | semmle.label | content | | reflectedxsstest.go:33:10:33:57 | type conversion | semmle.label | type conversion | | reflectedxsstest.go:33:17:33:56 | []type{args} [array] | semmle.label | []type{args} [array] | | reflectedxsstest.go:33:17:33:56 | call to Sprintf | semmle.label | call to Sprintf | diff --git a/go/ql/test/query-tests/Security/CWE-089/SqlInjection.expected b/go/ql/test/query-tests/Security/CWE-089/SqlInjection.expected index 70037706cfd8..eec5b6008142 100644 --- a/go/ql/test/query-tests/Security/CWE-089/SqlInjection.expected +++ b/go/ql/test/query-tests/Security/CWE-089/SqlInjection.expected @@ -30,7 +30,6 @@ edges | SqlInjection.go:11:3:11:9 | selection of URL | SqlInjection.go:11:3:11:17 | call to Query | provenance | Src:MaD:21 MaD:26 | | SqlInjection.go:11:3:11:17 | call to Query | SqlInjection.go:11:3:11:29 | index expression | provenance | | | SqlInjection.go:11:3:11:29 | index expression | SqlInjection.go:10:7:11:30 | []type{args} [array] | provenance | | -| SqlInjection.go:11:3:11:29 | index expression | SqlInjection.go:10:7:11:30 | call to Sprintf | provenance | FunctionModel | | issue48.go:17:2:17:33 | extract:0 ... := ... | issue48.go:18:17:18:17 | b | provenance | | | issue48.go:17:25:17:32 | selection of Body | issue48.go:17:2:17:33 | extract:0 ... := ... | provenance | Src:MaD:17 MaD:24 | | issue48.go:18:17:18:17 | b | issue48.go:18:20:18:39 | &... [postupdate] | provenance | MaD:22 | @@ -38,7 +37,6 @@ edges | issue48.go:20:8:21:34 | []type{args} [array] | issue48.go:20:8:21:34 | call to Sprintf | provenance | MaD:23 | | issue48.go:20:8:21:34 | call to Sprintf | issue48.go:22:11:22:12 | q3 | provenance | Sink:MaD:1 | | issue48.go:21:3:21:33 | index expression | issue48.go:20:8:21:34 | []type{args} [array] | provenance | | -| issue48.go:21:3:21:33 | index expression | issue48.go:20:8:21:34 | call to Sprintf | provenance | FunctionModel | | issue48.go:27:2:27:34 | extract:0 ... := ... | issue48.go:28:17:28:18 | b2 | provenance | | | issue48.go:27:26:27:33 | selection of Body | issue48.go:27:2:27:34 | extract:0 ... := ... | provenance | Src:MaD:17 MaD:24 | | issue48.go:28:17:28:18 | b2 | issue48.go:28:21:28:41 | &... [postupdate] | provenance | MaD:22 | @@ -46,7 +44,6 @@ edges | issue48.go:30:8:31:32 | []type{args} [array] | issue48.go:30:8:31:32 | call to Sprintf | provenance | MaD:23 | | issue48.go:30:8:31:32 | call to Sprintf | issue48.go:32:11:32:12 | q4 | provenance | Sink:MaD:1 | | issue48.go:31:3:31:31 | selection of Category | issue48.go:30:8:31:32 | []type{args} [array] | provenance | | -| issue48.go:31:3:31:31 | selection of Category | issue48.go:30:8:31:32 | call to Sprintf | provenance | FunctionModel | | issue48.go:37:17:37:50 | type conversion | issue48.go:37:53:37:73 | &... [postupdate] | provenance | MaD:22 | | issue48.go:37:24:37:30 | selection of URL | issue48.go:37:24:37:38 | call to Query | provenance | Src:MaD:21 MaD:26 | | issue48.go:37:24:37:38 | call to Query | issue48.go:37:17:37:50 | type conversion | provenance | | @@ -54,17 +51,14 @@ edges | issue48.go:39:8:40:32 | []type{args} [array] | issue48.go:39:8:40:32 | call to Sprintf | provenance | MaD:23 | | issue48.go:39:8:40:32 | call to Sprintf | issue48.go:41:11:41:12 | q5 | provenance | Sink:MaD:1 | | issue48.go:40:3:40:31 | selection of Category | issue48.go:39:8:40:32 | []type{args} [array] | provenance | | -| issue48.go:40:3:40:31 | selection of Category | issue48.go:39:8:40:32 | call to Sprintf | provenance | FunctionModel | | main.go:11:11:11:16 | selection of Form | main.go:11:11:11:28 | index expression | provenance | Src:MaD:18 Sink:MaD:1 | | main.go:15:11:15:84 | []type{args} [array] | main.go:15:11:15:84 | call to Sprintf | provenance | MaD:23 Sink:MaD:2 | | main.go:15:63:15:67 | selection of URL | main.go:15:63:15:75 | call to Query | provenance | Src:MaD:21 MaD:26 | | main.go:15:63:15:75 | call to Query | main.go:15:63:15:83 | index expression | provenance | | | main.go:15:63:15:83 | index expression | main.go:15:11:15:84 | []type{args} [array] | provenance | | -| main.go:15:63:15:83 | index expression | main.go:15:11:15:84 | call to Sprintf | provenance | FunctionModel Sink:MaD:2 | | main.go:16:11:16:85 | []type{args} [array] | main.go:16:11:16:85 | call to Sprintf | provenance | MaD:23 Sink:MaD:2 | | main.go:16:63:16:70 | selection of Header | main.go:16:63:16:84 | call to Get | provenance | Src:MaD:19 MaD:25 | | main.go:16:63:16:84 | call to Get | main.go:16:11:16:85 | []type{args} [array] | provenance | | -| main.go:16:63:16:84 | call to Get | main.go:16:11:16:85 | call to Sprintf | provenance | FunctionModel Sink:MaD:2 | | main.go:28:17:31:2 | &... [pointer, Category] | main.go:34:3:34:13 | RequestData [pointer, Category] | provenance | | | main.go:28:18:31:2 | struct literal [Category] | main.go:28:17:31:2 | &... [pointer, Category] | provenance | | | main.go:30:13:30:19 | selection of URL | main.go:30:13:30:27 | call to Query | provenance | Src:MaD:21 MaD:26 | @@ -75,7 +69,6 @@ edges | main.go:34:3:34:13 | RequestData [pointer, Category] | main.go:34:3:34:13 | implicit-deref RequestData [Category] | provenance | | | main.go:34:3:34:13 | implicit-deref RequestData [Category] | main.go:34:3:34:22 | selection of Category | provenance | | | main.go:34:3:34:22 | selection of Category | main.go:33:7:34:23 | []type{args} [array] | provenance | | -| main.go:34:3:34:22 | selection of Category | main.go:33:7:34:23 | call to Sprintf | provenance | FunctionModel | | main.go:40:2:40:12 | RequestData [postupdate] [pointer, Category] | main.go:43:3:43:13 | RequestData [pointer, Category] | provenance | | | main.go:40:2:40:12 | implicit-deref RequestData [postupdate] [Category] | main.go:40:2:40:12 | RequestData [postupdate] [pointer, Category] | provenance | | | main.go:40:25:40:31 | selection of URL | main.go:40:25:40:39 | call to Query | provenance | Src:MaD:21 MaD:26 | @@ -86,7 +79,6 @@ edges | main.go:43:3:43:13 | RequestData [pointer, Category] | main.go:43:3:43:13 | implicit-deref RequestData [Category] | provenance | | | main.go:43:3:43:13 | implicit-deref RequestData [Category] | main.go:43:3:43:22 | selection of Category | provenance | | | main.go:43:3:43:22 | selection of Category | main.go:42:7:43:23 | []type{args} [array] | provenance | | -| main.go:43:3:43:22 | selection of Category | main.go:42:7:43:23 | call to Sprintf | provenance | FunctionModel | | main.go:49:3:49:14 | star expression [postupdate] [Category] | main.go:49:4:49:14 | RequestData [postupdate] [pointer, Category] | provenance | | | main.go:49:4:49:14 | RequestData [postupdate] [pointer, Category] | main.go:52:3:52:13 | RequestData [pointer, Category] | provenance | | | main.go:49:28:49:34 | selection of URL | main.go:49:28:49:42 | call to Query | provenance | Src:MaD:21 MaD:26 | @@ -97,7 +89,6 @@ edges | main.go:52:3:52:13 | RequestData [pointer, Category] | main.go:52:3:52:13 | implicit-deref RequestData [Category] | provenance | | | main.go:52:3:52:13 | implicit-deref RequestData [Category] | main.go:52:3:52:22 | selection of Category | provenance | | | main.go:52:3:52:22 | selection of Category | main.go:51:7:52:23 | []type{args} [array] | provenance | | -| main.go:52:3:52:22 | selection of Category | main.go:51:7:52:23 | call to Sprintf | provenance | FunctionModel | | main.go:58:3:58:14 | star expression [postupdate] [Category] | main.go:58:4:58:14 | RequestData [postupdate] [pointer, Category] | provenance | | | main.go:58:4:58:14 | RequestData [postupdate] [pointer, Category] | main.go:61:5:61:15 | RequestData [pointer, Category] | provenance | | | main.go:58:28:58:34 | selection of URL | main.go:58:28:58:42 | call to Query | provenance | Src:MaD:21 MaD:26 | @@ -106,7 +97,6 @@ edges | main.go:60:7:61:26 | []type{args} [array] | main.go:60:7:61:26 | call to Sprintf | provenance | MaD:23 | | main.go:60:7:61:26 | call to Sprintf | main.go:62:11:62:11 | q | provenance | Sink:MaD:1 | | main.go:61:3:61:25 | selection of Category | main.go:60:7:61:26 | []type{args} [array] | provenance | | -| main.go:61:3:61:25 | selection of Category | main.go:60:7:61:26 | call to Sprintf | provenance | FunctionModel | | main.go:61:4:61:15 | star expression [Category] | main.go:61:3:61:25 | selection of Category | provenance | | | main.go:61:5:61:15 | RequestData [pointer, Category] | main.go:61:4:61:15 | star expression [Category] | provenance | | | mongoDB.go:40:20:40:30 | call to Referer | mongoDB.go:42:28:42:41 | untrustedInput | provenance | Src:MaD:20 | diff --git a/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected b/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected index ef5f3a1f7b94..b5c025372663 100644 --- a/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected +++ b/go/ql/test/query-tests/Security/CWE-338/InsecureRandomness/InsecureRandomness.expected @@ -10,7 +10,6 @@ edges | sample.go:15:31:15:62 | []type{args} [array] | sample.go:15:31:15:62 | call to Sprintf | provenance | MaD:1 | | sample.go:15:31:15:62 | call to Sprintf | sample.go:15:24:15:63 | type conversion | provenance | | | sample.go:15:49:15:61 | call to Uint32 | sample.go:15:31:15:62 | []type{args} [array] | provenance | | -| sample.go:15:49:15:61 | call to Uint32 | sample.go:15:31:15:62 | call to Sprintf | provenance | FunctionModel | | sample.go:16:9:16:15 | slice expression | sample.go:26:25:26:30 | call to Guid | provenance | | | sample.go:34:12:34:40 | call to New | sample.go:35:14:35:19 | random | provenance | | | sample.go:35:14:35:19 | random | sample.go:35:22:35:26 | nonce [postupdate] | provenance | MaD:2 | From 7026946da36a244abe61bc91fe77958b0a991a08 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema <93738568+jketema@users.noreply.github.com> Date: Fri, 20 Nov 2026 16:51:36 +0000 Subject: [PATCH 3/3] Go: Apply review suggestion to address test regression --- go/ql/lib/semmle/go/frameworks/Afero.qll | 20 +++++++++++++++++++ .../semmle/go/frameworks/Afero/test.go | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/go/ql/lib/semmle/go/frameworks/Afero.qll b/go/ql/lib/semmle/go/frameworks/Afero.qll index 758a6cd61d5b..8e0476839183 100644 --- a/go/ql/lib/semmle/go/frameworks/Afero.qll +++ b/go/ql/lib/semmle/go/frameworks/Afero.qll @@ -16,6 +16,26 @@ module Afero { */ string aferoPackage() { result = package("github.com/spf13/afero", "") } + /** + * A modeled filesystem method called through an interface on a value returned by an Afero + * constructor. These constructors return `Fs`, so the concrete-type data extensions do not apply. + */ + private class AferoConstructorSystemAccess extends FileSystemAccess::Range, DataFlow::CallNode { + AferoConstructorSystemAccess() { + exists(string fsType, string methodName, Method method, Function constructor | + fsType = ["OsFs", "MemMapFs", "ReadOnlyFs", "RegexpFs"] and + sinkModel("github.com/spf13/afero", fsType, _, methodName, "", "", "Argument[0]", + "path-injection", _, _) and + method.hasQualifiedName(aferoPackage(), fsType, methodName) and + this = method.getACall() and + constructor.hasQualifiedName(aferoPackage(), "New" + fsType) and + DataFlow::localFlow(constructor.getACall().getResult(0), this.getReceiver()) + ) + } + + override DataFlow::Node getAPathArgument() { result = this.getArgument(0) } + } + /** * The File system access sinks of [afero](https://github.com/spf13/afero) framework utility functions * diff --git a/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go b/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go index 1c3b923f9122..edfc960b59f4 100644 --- a/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go +++ b/go/ql/test/library-tests/semmle/go/frameworks/Afero/test.go @@ -20,11 +20,11 @@ func Afero(writer http.ResponseWriter, request *http.Request) { //osFS := afero.NewMemMapFs() // OR osFS := afero.NewOsFs() - fmt.Println(osFS.MkdirAll(filepath, 0755)) + fmt.Println(osFS.MkdirAll(filepath, 0755)) // $ FileSystemAccess=filepath fmt.Println(afero.WriteFile(osFS, filepath, []byte("this is me a !"), 0755)) // $ FileSystemAccess=filepath content, _ := afero.ReadFile(osFS, filepath) // $ FileSystemAccess=filepath fmt.Println(string(content)) - fmt.Println(osFS.Open(filepath)) + fmt.Println(osFS.Open(filepath)) // $ FileSystemAccess=filepath // NOT OK fmt.Println(afero.SafeWriteReader(osFS, filepath, os.Stdout)) // $ FileSystemAccess=filepath fmt.Println(afero.WriteReader(osFS, filepath, os.Stdout)) // $ FileSystemAccess=filepath