@@ -15,29 +15,29 @@ import csharp
1515import semmle.code.csharp.security.dataflow.flowsources.Remote
1616import semmle.code.csharp.security.dataflow.flowsources.Local
1717import semmle.code.csharp.frameworks.Format
18- import DataFlow :: PathGraph
18+ import FormatString :: PathGraph
1919
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 ) {
2422 source instanceof RemoteFlowSource
2523 or
2624 source instanceof LocalFlowSource
2725 }
2826
29- override predicate isSink ( DataFlow:: Node sink ) {
27+ predicate isSink ( DataFlow:: Node sink ) {
3028 sink .asExpr ( ) = any ( FormatCall call | call .hasInsertions ( ) ) .getFormatExpr ( )
3129 }
3230}
3331
32+ module FormatString = TaintTracking:: Global< FormatStringConfig > ;
33+
3434string getSourceType ( DataFlow:: Node node ) {
3535 result = node .( RemoteFlowSource ) .getSourceType ( )
3636 or
3737 result = node .( LocalFlowSource ) .getSourceType ( )
3838}
3939
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 )
4242select sink .getNode ( ) , source , sink , "This format string depends on $@." , source .getNode ( ) ,
4343 ( "this" + getSourceType ( source .getNode ( ) ) )
0 commit comments