Skip to content

Commit

Permalink
Convert ElazarlGoproxy::UserControlledRequestData to MaD
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-mc committed Jun 27, 2024
1 parent f8b5d29 commit 18061d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
7 changes: 7 additions & 0 deletions go/ql/lib/ext/github.com.elazarl.goproxy.model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ extensions:
data:
- ["github.com/elazarl/goproxy", "CertStorage", True, "Fetch", "", "", "Argument[receiver]", "ReturnValue[0]", "taint", "manual"]
- ["github.com/elazarl/goproxy", "CertStorage", True, "Fetch", "", "", "Argument[1]", "ReturnValue[0]", "taint", "manual"]

- addsTo:
pack: codeql/go-all
extensible: sourceModel
data:
- ["github.com/elazarl/goproxy", "ProxyCtx", True, "UserData", "", "", "", "remote", "manual"]
- ["github.com/elazarl/goproxy", "ProxyCtx", True, "Charset", "", "", "ReturnValue", "remote", "manual"]
13 changes: 0 additions & 13 deletions go/ql/lib/semmle/go/frameworks/ElazarlGoproxy.qll
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,6 @@ module ElazarlGoproxy {
}
}

private class UserControlledRequestData extends RemoteFlowSource::Range {
UserControlledRequestData() {
exists(DataFlow::FieldReadNode frn | this = frn |
// liberally consider ProxyCtx.UserData to be untrusted; it's a data field set by a request handler
frn.getField().hasQualifiedName(packagePath(), "ProxyCtx", "UserData")
)
or
exists(DataFlow::MethodCallNode call | this = call |
call.getTarget().hasQualifiedName(packagePath(), "ProxyCtx", "Charset")
)
}
}

private class ProxyLogFunction extends StringOps::Formatting::Range, Method {
ProxyLogFunction() { this.hasQualifiedName(packagePath(), "ProxyCtx", ["Logf", "Warnf"]) }

Expand Down

0 comments on commit 18061d1

Please sign in to comment.