44
55import csharp
66private import semmle.code.csharp.frameworks.system.windows.Forms
7+ private import semmle.code.csharp.dataflow.ExternalFlow
78
89/** A data flow source of local data. */
910abstract class LocalFlowSource extends DataFlow:: Node {
1011 /** Gets a string that describes the type of this local flow source. */
1112 abstract string getSourceType ( ) ;
1213}
1314
15+ private class ExternalLocalFlowSource extends LocalFlowSource {
16+ ExternalLocalFlowSource ( ) { sourceNode ( this , "local" ) }
17+
18+ override string getSourceType ( ) { result = "external" }
19+ }
20+
1421/** A data flow source of local user input. */
1522abstract class LocalUserInputSource extends LocalFlowSource { }
1623
@@ -22,13 +29,13 @@ class TextFieldSource extends LocalUserInputSource {
2229}
2330
2431/** A call to any `System.Console.Read*` method. */
25- class SystemConsoleReadSource extends LocalUserInputSource {
26- SystemConsoleReadSource ( ) {
27- this .asExpr ( ) =
28- any ( MethodCall call |
29- call .getTarget ( ) .hasQualifiedName ( "System.Console" , [ "ReadLine" , "Read" , "ReadKey" ] )
30- )
32+ private class SystemConsoleReadSourceModelCsv extends SourceModelCsv {
33+ override predicate row ( string row ) {
34+ row =
35+ [
36+ "System;Console;false;ReadLine;;;ReturnValue;local" ,
37+ "System;Console;false;Read;;;ReturnValue;local" ,
38+ "System;Console;false;ReadKey;;;ReturnValue;local"
39+ ]
3140 }
32-
33- override string getSourceType ( ) { result = "System.Console input" }
3441}
0 commit comments