Skip to content

Commit f00c978

Browse files
committed
C#: Re-factor the NHibernate test.
1 parent 9c60c4b commit f00c978

File tree

1 file changed

+7
-9
lines changed
  • csharp/ql/test/library-tests/frameworks/NHibernate

1 file changed

+7
-9
lines changed
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import csharp
22

3-
class MyConfiguration extends TaintTracking::Configuration {
4-
MyConfiguration() { this = "MyConfiguration" }
3+
module TaintConfig implements DataFlow::ConfigSig {
4+
predicate isSource(DataFlow::Node node) { node.asExpr().(StringLiteral).getValue() = "tainted" }
55

6-
override predicate isSource(DataFlow::Node node) {
7-
node.asExpr().(StringLiteral).getValue() = "tainted"
8-
}
9-
10-
override predicate isSink(DataFlow::Node node) {
6+
predicate isSink(DataFlow::Node node) {
117
exists(MethodCall mc | mc.getTarget().hasName("Sink") and node.asExpr() = mc.getArgument(0))
128
}
139
}
1410

15-
from MyConfiguration config, DataFlow::Node source, DataFlow::Node sink
16-
where config.hasFlow(source, sink)
11+
module Taint = TaintTracking::Global<TaintConfig>;
12+
13+
from DataFlow::Node source, DataFlow::Node sink
14+
where Taint::flow(source, sink)
1715
select sink, "Data flow from $@.", source, source.toString()

0 commit comments

Comments
 (0)