From 05da8dff0dbbff877142459aab103cf0212829c4 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Sun, 23 Jun 2024 07:21:58 +0100 Subject: [PATCH] Convert EchoContextSource to MaD --- .../lib/ext/github.com.labstack.echo.model.yml | 16 ++++++++++++++++ go/ql/lib/semmle/go/frameworks/Echo.qll | 17 ----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/go/ql/lib/ext/github.com.labstack.echo.model.yml b/go/ql/lib/ext/github.com.labstack.echo.model.yml index 41de417d5c2bc..a6b1be0929883 100644 --- a/go/ql/lib/ext/github.com.labstack.echo.model.yml +++ b/go/ql/lib/ext/github.com.labstack.echo.model.yml @@ -5,3 +5,19 @@ extensions: data: - ["github.com/labstack/echo", "Context", True, "Get", "", "", "Argument[receiver]", "ReturnValue", "taint", "manual"] - ["github.com/labstack/echo", "Context", True, "Set", "", "", "Argument[1]", "Argument[receiver]", "taint", "manual"] + + - addsTo: + pack: codeql/go-all + extensible: sourceModel + data: + - ["github.com/labstack/echo", "Context", True, "Param", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "ParamValues", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "QueryParam", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "QueryParams", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "QueryString", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "FormValue", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "FormParams", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "FormFile", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "MultipartForm", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "Cookie", "", "", "ReturnValue[0]", "remote", "manual"] + - ["github.com/labstack/echo", "Context", True, "Cookies", "", "", "ReturnValue[0]", "remote", "manual"] diff --git a/go/ql/lib/semmle/go/frameworks/Echo.qll b/go/ql/lib/semmle/go/frameworks/Echo.qll index b27893824c129..11f3646150c2e 100644 --- a/go/ql/lib/semmle/go/frameworks/Echo.qll +++ b/go/ql/lib/semmle/go/frameworks/Echo.qll @@ -9,23 +9,6 @@ private module Echo { /** Gets the package name `github.com/labstack/echo`. */ private string packagePath() { result = package("github.com/labstack/echo", "") } - /** - * Data from a `Context` interface method, considered as a source of remote flow. - */ - private class EchoContextSource extends RemoteFlowSource::Range { - EchoContextSource() { - exists(DataFlow::MethodCallNode call, string methodName | - methodName = - [ - "Param", "ParamValues", "QueryParam", "QueryParams", "QueryString", "FormValue", - "FormParams", "FormFile", "MultipartForm", "Cookie", "Cookies" - ] and - call.getTarget().hasQualifiedName(packagePath(), "Context", methodName) and - this = call.getResult(0) - ) - } - } - /** * Data from a `Context` interface method that is not generally exploitable for open-redirect attacks. */