Skip to content

Commit cccb11f

Browse files
authored
Merge pull request github#16091 from hvitved/csharp/system-diagnostics-modules
C#: Neutralize some `System.Diagnostics` generated models
2 parents d7e5149 + 368a500 commit cccb11f

File tree

4 files changed

+14
-27
lines changed

4 files changed

+14
-27
lines changed

csharp/ql/lib/ext/System.Diagnostics.model.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ extensions:
1919
- ["System.Diagnostics", "TraceListenerCollection", False, "get_Item", "(System.Int32)", "", "Argument[this].Element", "ReturnValue", "value", "manual"]
2020
- ["System.Diagnostics", "TraceListenerCollection", False, "get_Item", "(System.String)", "", "Argument[this].Element", "ReturnValue", "value", "manual"]
2121
- ["System.Diagnostics", "TraceListenerCollection", False, "set_Item", "(System.Int32,System.Diagnostics.TraceListener)", "", "Argument[1]", "Argument[this].Element", "value", "manual"]
22+
- addsTo:
23+
pack: codeql/csharp-all
24+
extensible: neutralModel
25+
data:
26+
- ["System.Diagnostics", "ProcessStartInfo", "set_Arguments", "(System.String)", "summary", "manual"]
27+
- ["System.Diagnostics", "ProcessStartInfo", "set_FileName", "(System.String)", "summary", "manual"]
28+
- ["System.Diagnostics", "ProcessStartInfo", "set_UserName", "(System.String)", "summary", "manual"]
29+
- ["System.Diagnostics", "ProcessStartInfo", "set_Verb", "(System.String)", "summary", "manual"]
30+
- ["System.Diagnostics", "ProcessStartInfo", "set_WorkingDirectory", "(System.String)", "summary", "manual"]

csharp/ql/test/library-tests/dataflow/library/FlowSummaries.expected

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9080,11 +9080,6 @@ summary
90809080
| System.Diagnostics;ProcessStartInfo;false;get_UserName;();;Argument[this];ReturnValue;taint;df-generated |
90819081
| System.Diagnostics;ProcessStartInfo;false;get_Verb;();;Argument[this];ReturnValue;taint;df-generated |
90829082
| System.Diagnostics;ProcessStartInfo;false;get_WorkingDirectory;();;Argument[this];ReturnValue;taint;df-generated |
9083-
| System.Diagnostics;ProcessStartInfo;false;set_Arguments;(System.String);;Argument[0];Argument[this];taint;df-generated |
9084-
| System.Diagnostics;ProcessStartInfo;false;set_FileName;(System.String);;Argument[0];Argument[this];taint;df-generated |
9085-
| System.Diagnostics;ProcessStartInfo;false;set_UserName;(System.String);;Argument[0];Argument[this];taint;df-generated |
9086-
| System.Diagnostics;ProcessStartInfo;false;set_Verb;(System.String);;Argument[0];Argument[this];taint;df-generated |
9087-
| System.Diagnostics;ProcessStartInfo;false;set_WorkingDirectory;(System.String);;Argument[0];Argument[this];taint;df-generated |
90889083
| System.Diagnostics;ProcessThreadCollection;false;Add;(System.Diagnostics.ProcessThread);;Argument[0];Argument[this].Element;value;manual |
90899084
| System.Diagnostics;ProcessThreadCollection;false;CopyTo;(System.Diagnostics.ProcessThread[],System.Int32);;Argument[this].Element;Argument[0].Element;value;manual |
90909085
| System.Diagnostics;SampleActivity<T>;false;BeginInvoke;(System.Diagnostics.ActivityCreationOptions<T>,System.AsyncCallback,System.Object);;Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated |
@@ -28362,10 +28357,12 @@ neutral
2836228357
| System.Diagnostics;ProcessStartInfo;get_UseShellExecute;();summary;df-generated |
2836328358
| System.Diagnostics;ProcessStartInfo;get_Verbs;();summary;df-generated |
2836428359
| System.Diagnostics;ProcessStartInfo;get_WindowStyle;();summary;df-generated |
28360+
| System.Diagnostics;ProcessStartInfo;set_Arguments;(System.String);summary;manual |
2836528361
| System.Diagnostics;ProcessStartInfo;set_CreateNoWindow;(System.Boolean);summary;df-generated |
2836628362
| System.Diagnostics;ProcessStartInfo;set_Domain;(System.String);summary;df-generated |
2836728363
| System.Diagnostics;ProcessStartInfo;set_ErrorDialog;(System.Boolean);summary;df-generated |
2836828364
| System.Diagnostics;ProcessStartInfo;set_ErrorDialogParentHandle;(System.IntPtr);summary;df-generated |
28365+
| System.Diagnostics;ProcessStartInfo;set_FileName;(System.String);summary;manual |
2836928366
| System.Diagnostics;ProcessStartInfo;set_LoadUserProfile;(System.Boolean);summary;df-generated |
2837028367
| System.Diagnostics;ProcessStartInfo;set_Password;(System.Security.SecureString);summary;df-generated |
2837128368
| System.Diagnostics;ProcessStartInfo;set_PasswordInClearText;(System.String);summary;df-generated |
@@ -28377,7 +28374,10 @@ neutral
2837728374
| System.Diagnostics;ProcessStartInfo;set_StandardOutputEncoding;(System.Text.Encoding);summary;df-generated |
2837828375
| System.Diagnostics;ProcessStartInfo;set_UseCredentialsForNetworkingOnly;(System.Boolean);summary;df-generated |
2837928376
| System.Diagnostics;ProcessStartInfo;set_UseShellExecute;(System.Boolean);summary;df-generated |
28377+
| System.Diagnostics;ProcessStartInfo;set_UserName;(System.String);summary;manual |
28378+
| System.Diagnostics;ProcessStartInfo;set_Verb;(System.String);summary;manual |
2838028379
| System.Diagnostics;ProcessStartInfo;set_WindowStyle;(System.Diagnostics.ProcessWindowStyle);summary;df-generated |
28380+
| System.Diagnostics;ProcessStartInfo;set_WorkingDirectory;(System.String);summary;manual |
2838128381
| System.Diagnostics;ProcessThread;ResetIdealProcessor;();summary;df-generated |
2838228382
| System.Diagnostics;ProcessThread;get_BasePriority;();summary;df-generated |
2838328383
| System.Diagnostics;ProcessThread;get_CurrentPriority;();summary;df-generated |

csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.expected

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7031,11 +7031,6 @@
70317031
| System.Diagnostics;ProcessStartInfo;false;get_UserName;();;Argument[this];ReturnValue;taint;df-generated |
70327032
| System.Diagnostics;ProcessStartInfo;false;get_Verb;();;Argument[this];ReturnValue;taint;df-generated |
70337033
| System.Diagnostics;ProcessStartInfo;false;get_WorkingDirectory;();;Argument[this];ReturnValue;taint;df-generated |
7034-
| System.Diagnostics;ProcessStartInfo;false;set_Arguments;(System.String);;Argument[0];Argument[this];taint;df-generated |
7035-
| System.Diagnostics;ProcessStartInfo;false;set_FileName;(System.String);;Argument[0];Argument[this];taint;df-generated |
7036-
| System.Diagnostics;ProcessStartInfo;false;set_UserName;(System.String);;Argument[0];Argument[this];taint;df-generated |
7037-
| System.Diagnostics;ProcessStartInfo;false;set_Verb;(System.String);;Argument[0];Argument[this];taint;df-generated |
7038-
| System.Diagnostics;ProcessStartInfo;false;set_WorkingDirectory;(System.String);;Argument[0];Argument[this];taint;df-generated |
70397034
| System.Diagnostics;ProcessThreadCollection;false;Add;(System.Diagnostics.ProcessThread);;Argument[0];Argument[this].Element;value;manual |
70407035
| System.Diagnostics;ProcessThreadCollection;false;CopyTo;(System.Diagnostics.ProcessThread[],System.Int32);;Argument[this].Element;Argument[0].Element;value;manual |
70417036
| System.Diagnostics;SampleActivity<T>;false;BeginInvoke;(System.Diagnostics.ActivityCreationOptions<T>,System.AsyncCallback,System.Object);;Argument[1];Argument[1].Parameter[delegate-self];value;hq-generated |

csharp/ql/test/query-tests/Security Features/CWE-078/CommandInjection.expected

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,14 @@ edges
66
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:30:74:30:82 | access to local variable userInput | provenance | |
77
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:30:74:30:82 | access to local variable userInput : String | provenance | |
88
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:34:39:34:47 | access to local variable userInput | provenance | |
9-
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:34:39:34:47 | access to local variable userInput : String | provenance | |
109
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:35:40:35:48 | access to local variable userInput | provenance | |
11-
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:35:40:35:48 | access to local variable userInput : String | provenance | |
1210
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:36:47:36:55 | access to local variable userInput | provenance | |
13-
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | CommandInjection.cs:36:47:36:55 | access to local variable userInput : String | provenance | |
1411
| CommandInjection.cs:27:32:27:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:27:32:27:51 | access to property Text : String | provenance | |
1512
| CommandInjection.cs:27:32:27:51 | access to property Text : String | CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | provenance | |
1613
| CommandInjection.cs:30:30:30:38 | access to local variable startInfo : ProcessStartInfo | CommandInjection.cs:31:27:31:35 | access to local variable startInfo | provenance | |
1714
| CommandInjection.cs:30:42:30:83 | object creation of type ProcessStartInfo : ProcessStartInfo | CommandInjection.cs:30:30:30:38 | access to local variable startInfo : ProcessStartInfo | provenance | |
1815
| CommandInjection.cs:30:63:30:71 | access to local variable userInput : String | CommandInjection.cs:30:42:30:83 | object creation of type ProcessStartInfo : ProcessStartInfo | provenance | |
1916
| CommandInjection.cs:30:74:30:82 | access to local variable userInput : String | CommandInjection.cs:30:42:30:83 | object creation of type ProcessStartInfo : ProcessStartInfo | provenance | |
20-
| CommandInjection.cs:34:13:34:26 | [post] access to local variable startInfoProps : ProcessStartInfo | CommandInjection.cs:37:27:37:40 | access to local variable startInfoProps | provenance | |
21-
| CommandInjection.cs:34:39:34:47 | access to local variable userInput : String | CommandInjection.cs:34:13:34:26 | [post] access to local variable startInfoProps : ProcessStartInfo | provenance | |
22-
| CommandInjection.cs:35:13:35:26 | [post] access to local variable startInfoProps : ProcessStartInfo | CommandInjection.cs:37:27:37:40 | access to local variable startInfoProps | provenance | |
23-
| CommandInjection.cs:35:40:35:48 | access to local variable userInput : String | CommandInjection.cs:35:13:35:26 | [post] access to local variable startInfoProps : ProcessStartInfo | provenance | |
24-
| CommandInjection.cs:36:13:36:26 | [post] access to local variable startInfoProps : ProcessStartInfo | CommandInjection.cs:37:27:37:40 | access to local variable startInfoProps | provenance | |
25-
| CommandInjection.cs:36:47:36:55 | access to local variable userInput : String | CommandInjection.cs:36:13:36:26 | [post] access to local variable startInfoProps : ProcessStartInfo | provenance | |
2617
| CommandInjection.cs:51:54:51:80 | call to method GetString : String | CommandInjection.cs:51:46:51:80 | ... + ... | provenance | |
2718
nodes
2819
| CommandInjection.cs:27:20:27:28 | access to local variable userInput : String | semmle.label | access to local variable userInput : String |
@@ -37,16 +28,9 @@ nodes
3728
| CommandInjection.cs:30:74:30:82 | access to local variable userInput | semmle.label | access to local variable userInput |
3829
| CommandInjection.cs:30:74:30:82 | access to local variable userInput : String | semmle.label | access to local variable userInput : String |
3930
| CommandInjection.cs:31:27:31:35 | access to local variable startInfo | semmle.label | access to local variable startInfo |
40-
| CommandInjection.cs:34:13:34:26 | [post] access to local variable startInfoProps : ProcessStartInfo | semmle.label | [post] access to local variable startInfoProps : ProcessStartInfo |
4131
| CommandInjection.cs:34:39:34:47 | access to local variable userInput | semmle.label | access to local variable userInput |
42-
| CommandInjection.cs:34:39:34:47 | access to local variable userInput : String | semmle.label | access to local variable userInput : String |
43-
| CommandInjection.cs:35:13:35:26 | [post] access to local variable startInfoProps : ProcessStartInfo | semmle.label | [post] access to local variable startInfoProps : ProcessStartInfo |
4432
| CommandInjection.cs:35:40:35:48 | access to local variable userInput | semmle.label | access to local variable userInput |
45-
| CommandInjection.cs:35:40:35:48 | access to local variable userInput : String | semmle.label | access to local variable userInput : String |
46-
| CommandInjection.cs:36:13:36:26 | [post] access to local variable startInfoProps : ProcessStartInfo | semmle.label | [post] access to local variable startInfoProps : ProcessStartInfo |
4733
| CommandInjection.cs:36:47:36:55 | access to local variable userInput | semmle.label | access to local variable userInput |
48-
| CommandInjection.cs:36:47:36:55 | access to local variable userInput : String | semmle.label | access to local variable userInput : String |
49-
| CommandInjection.cs:37:27:37:40 | access to local variable startInfoProps | semmle.label | access to local variable startInfoProps |
5034
| CommandInjection.cs:51:46:51:80 | ... + ... | semmle.label | ... + ... |
5135
| CommandInjection.cs:51:54:51:80 | call to method GetString : String | semmle.label | call to method GetString : String |
5236
subpaths
@@ -59,5 +43,4 @@ subpaths
5943
| CommandInjection.cs:34:39:34:47 | access to local variable userInput | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:34:39:34:47 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox | user-provided value |
6044
| CommandInjection.cs:35:40:35:48 | access to local variable userInput | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:35:40:35:48 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox | user-provided value |
6145
| CommandInjection.cs:36:47:36:55 | access to local variable userInput | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:36:47:36:55 | access to local variable userInput | This command line depends on a $@. | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox | user-provided value |
62-
| CommandInjection.cs:37:27:37:40 | access to local variable startInfoProps | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox : TextBox | CommandInjection.cs:37:27:37:40 | access to local variable startInfoProps | This command line depends on a $@. | CommandInjection.cs:27:32:27:46 | access to field categoryTextBox | user-provided value |
6346
| CommandInjection.cs:51:46:51:80 | ... + ... | CommandInjection.cs:51:54:51:80 | call to method GetString : String | CommandInjection.cs:51:46:51:80 | ... + ... | This command line depends on a $@. | CommandInjection.cs:51:54:51:80 | call to method GetString | user-provided value |

0 commit comments

Comments
 (0)