@@ -15,29 +15,29 @@ import csharp
15
15
import semmle.code.csharp.security.dataflow.flowsources.Remote
16
16
import semmle.code.csharp.security.dataflow.flowsources.Local
17
17
import semmle.code.csharp.frameworks.Format
18
- import DataFlow :: PathGraph
18
+ import FormatString :: PathGraph
19
19
20
- class FormatStringConfiguration extends TaintTracking:: Configuration {
21
- FormatStringConfiguration ( ) { this = "FormatStringConfiguration" }
22
-
23
- override predicate isSource ( DataFlow:: Node source ) {
20
+ module FormatStringConfig implements DataFlow:: ConfigSig {
21
+ predicate isSource ( DataFlow:: Node source ) {
24
22
source instanceof RemoteFlowSource
25
23
or
26
24
source instanceof LocalFlowSource
27
25
}
28
26
29
- override predicate isSink ( DataFlow:: Node sink ) {
27
+ predicate isSink ( DataFlow:: Node sink ) {
30
28
sink .asExpr ( ) = any ( FormatCall call | call .hasInsertions ( ) ) .getFormatExpr ( )
31
29
}
32
30
}
33
31
32
+ module FormatString = TaintTracking:: Global< FormatStringConfig > ;
33
+
34
34
string getSourceType ( DataFlow:: Node node ) {
35
35
result = node .( RemoteFlowSource ) .getSourceType ( )
36
36
or
37
37
result = node .( LocalFlowSource ) .getSourceType ( )
38
38
}
39
39
40
- from FormatStringConfiguration config , DataFlow :: PathNode source , DataFlow :: PathNode sink
41
- where config . hasFlowPath ( source , sink )
40
+ from FormatString :: PathNode source , FormatString :: PathNode sink
41
+ where FormatString :: flowPath ( source , sink )
42
42
select sink .getNode ( ) , source , sink , "This format string depends on $@." , source .getNode ( ) ,
43
43
( "this" + getSourceType ( source .getNode ( ) ) )
0 commit comments