Skip to content

Commit 5ea6cea

Browse files
committed
C#: Re-factor DapperCommandDefinitionMethodCallSqlExpr to use the new API.
1 parent fdd975b commit 5ea6cea

File tree

1 file changed

+7
-6
lines changed
  • csharp/ql/lib/semmle/code/csharp/frameworks

1 file changed

+7
-6
lines changed

csharp/ql/lib/semmle/code/csharp/frameworks/Sql.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,24 @@ class IDbCommandConstructionSqlExpr extends SqlExpr, ObjectCreation {
5252
class DapperCommandDefinitionMethodCallSqlExpr extends SqlExpr, ObjectCreation {
5353
DapperCommandDefinitionMethodCallSqlExpr() {
5454
this.getObjectType() instanceof Dapper::CommandDefinitionStruct and
55-
exists(Conf c | c.hasFlow(DataFlow::exprNode(this), _))
55+
DapperCommandDefinitionMethodCallSql::flow(DataFlow::exprNode(this), _)
5656
}
5757

5858
override Expr getSql() { result = this.getArgumentForName("commandText") }
5959
}
6060

61-
private class Conf extends DataFlow4::Configuration {
62-
Conf() { this = "DapperCommandDefinitionFlowConfig" }
63-
64-
override predicate isSource(DataFlow::Node node) {
61+
private module DapperCommandDefitionMethodCallSqlConfig implements DataFlow::ConfigSig {
62+
predicate isSource(DataFlow::Node node) {
6563
node.asExpr().(ObjectCreation).getObjectType() instanceof Dapper::CommandDefinitionStruct
6664
}
6765

68-
override predicate isSink(DataFlow::Node node) {
66+
predicate isSink(DataFlow::Node node) {
6967
exists(MethodCall mc |
7068
mc.getTarget() = any(Dapper::SqlMapperClass c).getAQueryMethod() and
7169
node.asExpr() = mc.getArgumentForName("command")
7270
)
7371
}
7472
}
73+
74+
private module DapperCommandDefinitionMethodCallSql =
75+
DataFlow::Global<DapperCommandDefitionMethodCallSqlConfig>;

0 commit comments

Comments
 (0)