Skip to content

Commit d8a2c08

Browse files
committed
Revert "Convert Xorm sql-injection sinks to MaD"
This reverts commit 3b2b7d7.
1 parent 59bb142 commit d8a2c08

File tree

2 files changed

+22
-53
lines changed

2 files changed

+22
-53
lines changed

go/ql/lib/ext/xorm.io.xorm.model.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

go/ql/lib/semmle/go/frameworks/SQL.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,28 @@ module Gorm {
164164
module Xorm {
165165
/** Gets the package name for Xorm. */
166166
string packagePath() { result = package(["xorm.io/xorm", "github.com/go-xorm/xorm"], "") }
167+
168+
/** A model for sinks of XORM. */
169+
private class XormSink extends SQL::QueryString::Range {
170+
XormSink() {
171+
exists(Method meth, string type, string name, int n |
172+
meth.hasQualifiedName(Xorm::packagePath(), type, name) and
173+
this = meth.getACall().getSyntacticArgument(n) and
174+
type = ["Engine", "Session"]
175+
|
176+
name =
177+
[
178+
"Query", "Exec", "QueryString", "QueryInterface", "SQL", "Where", "And", "Or", "Alias",
179+
"NotIn", "In", "Select", "SetExpr", "OrderBy", "Having", "GroupBy"
180+
] and
181+
n = 0
182+
or
183+
name = ["SumInt", "Sum", "Sums", "SumsInt"] and n = 1
184+
or
185+
name = "Join" and n = [0, 1, 2]
186+
)
187+
}
188+
}
167189
}
168190

169191
/**

0 commit comments

Comments
 (0)