4
4
5
5
import csharp
6
6
private import semmle.code.csharp.frameworks.system.windows.Forms
7
+ private import semmle.code.csharp.dataflow.ExternalFlow
7
8
8
9
/** A data flow source of local data. */
9
10
abstract class LocalFlowSource extends DataFlow:: Node {
10
11
/** Gets a string that describes the type of this local flow source. */
11
12
abstract string getSourceType ( ) ;
12
13
}
13
14
15
+ private class ExternalLocalFlowSource extends LocalFlowSource {
16
+ ExternalLocalFlowSource ( ) { sourceNode ( this , "local" ) }
17
+
18
+ override string getSourceType ( ) { result = "external" }
19
+ }
20
+
14
21
/** A data flow source of local user input. */
15
22
abstract class LocalUserInputSource extends LocalFlowSource { }
16
23
@@ -22,13 +29,13 @@ class TextFieldSource extends LocalUserInputSource {
22
29
}
23
30
24
31
/** 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
+ ]
31
40
}
32
-
33
- override string getSourceType ( ) { result = "System.Console input" }
34
41
}
0 commit comments