Skip to content

Commit b56d52e

Browse files
committed
C#: Normalize model ids (provides more stable test output).
1 parent 7e5b552 commit b56d52e

File tree

8 files changed

+42
-21
lines changed

8 files changed

+42
-21
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @kind test-postprocess
3+
*/
4+
5+
import semmle.code.csharp.dataflow.internal.ExternalFlow
6+
import codeql.dataflow.test.ProvenancePathGraph
7+
import codeql.dataflow.test.ProvenancePathGraph::TestPostProcessing::TranslateProvenanceResults<interpretModelForTest/2>
8+
9+
from string relation, int row, int column, string data
10+
where results(relation, row, column, data)
11+
select relation, row, column, data
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
security/CWE-328/WeakHashingAlgorithms.ql
1+
query: security/CWE-328/WeakHashingAlgorithms.ql
2+
postprocess: TestUtilities/PrettyPrintModels.ql

csharp/test/security/CWE-328/WeakPasswordHashing.expected

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1+
#select
2+
| WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | Insecure hashing algorithm (MD5) depends on $@. | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password | password (access to parameter password) |
3+
| WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | Insecure hashing algorithm (SHA1) depends on $@. | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password | password (access to parameter password) |
4+
| WeakHashingAlgorithms.cs:79:45:79:49 | access to local variable bytes | WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password : String | WeakHashingAlgorithms.cs:79:45:79:49 | access to local variable bytes | Insecure hashing algorithm (SHA512) depends on $@. | WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password | password (access to parameter password) |
15
edges
26
| WeakHashingAlgorithms.cs:52:16:52:20 | access to local variable bytes : Byte[] | WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | provenance | |
37
| WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | WeakHashingAlgorithms.cs:52:16:52:20 | access to local variable bytes : Byte[] | provenance | |
4-
| WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
8+
| WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | provenance | MaD:1 |
59
| WeakHashingAlgorithms.cs:65:16:65:20 | access to local variable bytes : Byte[] | WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | provenance | |
610
| WeakHashingAlgorithms.cs:65:24:65:58 | call to method GetBytes : Byte[] | WeakHashingAlgorithms.cs:65:16:65:20 | access to local variable bytes : Byte[] | provenance | |
7-
| WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:65:24:65:58 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
11+
| WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:65:24:65:58 | call to method GetBytes : Byte[] | provenance | MaD:1 |
812
| WeakHashingAlgorithms.cs:78:16:78:20 | access to local variable bytes : Byte[] | WeakHashingAlgorithms.cs:79:45:79:49 | access to local variable bytes | provenance | |
913
| WeakHashingAlgorithms.cs:78:24:78:58 | call to method GetBytes : Byte[] | WeakHashingAlgorithms.cs:78:16:78:20 | access to local variable bytes : Byte[] | provenance | |
10-
| WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password : String | WeakHashingAlgorithms.cs:78:24:78:58 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
14+
| WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password : String | WeakHashingAlgorithms.cs:78:24:78:58 | call to method GetBytes : Byte[] | provenance | MaD:1 |
15+
models
16+
| 1 | Summary: System.Text; Encoding; true; GetBytes; (System.String); ; Argument[0]; ReturnValue; taint; manual |
1117
nodes
1218
| WeakHashingAlgorithms.cs:52:16:52:20 | access to local variable bytes : Byte[] | semmle.label | access to local variable bytes : Byte[] |
1319
| WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | semmle.label | call to method GetBytes : Byte[] |
@@ -22,7 +28,3 @@ nodes
2228
| WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password : String | semmle.label | access to parameter password : String |
2329
| WeakHashingAlgorithms.cs:79:45:79:49 | access to local variable bytes | semmle.label | access to local variable bytes |
2430
subpaths
25-
#select
26-
| WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | Insecure hashing algorithm (MD5) depends on $@. | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password | password (access to parameter password) |
27-
| WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | Insecure hashing algorithm (SHA1) depends on $@. | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password | password (access to parameter password) |
28-
| WeakHashingAlgorithms.cs:79:45:79:49 | access to local variable bytes | WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password : String | WeakHashingAlgorithms.cs:79:45:79:49 | access to local variable bytes | Insecure hashing algorithm (SHA512) depends on $@. | WeakHashingAlgorithms.cs:78:50:78:57 | access to parameter password | password (access to parameter password) |
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
security/CWE-328/WeakPasswordHashing.ql
1+
query: security/CWE-328/WeakPasswordHashing.ql
2+
postprocess: TestUtilities/PrettyPrintModels.ql

csharp/test/security/CWE-328/WeakSensitiveDataHashing.expected

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
#select
2+
| WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | Insecure hashing algorithm (MD5) depends on $@. | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password | sensitive data (access to parameter password) |
3+
| WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | Insecure hashing algorithm (SHA1) depends on $@. | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password | sensitive data (access to parameter password) |
14
edges
25
| WeakHashingAlgorithms.cs:52:16:52:20 | access to local variable bytes : Byte[] | WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | provenance | |
36
| WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | WeakHashingAlgorithms.cs:52:16:52:20 | access to local variable bytes : Byte[] | provenance | |
4-
| WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
7+
| WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | provenance | MaD:1 |
58
| WeakHashingAlgorithms.cs:65:16:65:20 | access to local variable bytes : Byte[] | WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | provenance | |
69
| WeakHashingAlgorithms.cs:65:24:65:58 | call to method GetBytes : Byte[] | WeakHashingAlgorithms.cs:65:16:65:20 | access to local variable bytes : Byte[] | provenance | |
7-
| WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:65:24:65:58 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
10+
| WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:65:24:65:58 | call to method GetBytes : Byte[] | provenance | MaD:1 |
11+
models
12+
| 1 | Summary: System.Text; Encoding; true; GetBytes; (System.String); ; Argument[0]; ReturnValue; taint; manual |
813
nodes
914
| WeakHashingAlgorithms.cs:52:16:52:20 | access to local variable bytes : Byte[] | semmle.label | access to local variable bytes : Byte[] |
1015
| WeakHashingAlgorithms.cs:52:24:52:58 | call to method GetBytes : Byte[] | semmle.label | call to method GetBytes : Byte[] |
@@ -15,6 +20,3 @@ nodes
1520
| WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | semmle.label | access to parameter password : String |
1621
| WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | semmle.label | access to local variable bytes |
1722
subpaths
18-
#select
19-
| WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password : String | WeakHashingAlgorithms.cs:53:42:53:46 | access to local variable bytes | Insecure hashing algorithm (MD5) depends on $@. | WeakHashingAlgorithms.cs:52:50:52:57 | access to parameter password | sensitive data (access to parameter password) |
20-
| WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password : String | WeakHashingAlgorithms.cs:66:43:66:47 | access to local variable bytes | Insecure hashing algorithm (SHA1) depends on $@. | WeakHashingAlgorithms.cs:65:50:65:57 | access to parameter password | sensitive data (access to parameter password) |
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
security/CWE-328/WeakSensitiveDataHashing.ql
1+
query: security/CWE-328/WeakSensitiveDataHashing.ql
2+
postprocess: TestUtilities/PrettyPrintModels.ql

csharp/test/security/CWE-760/HardcodedSalt.expected

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
#select
2+
| StaticSalt.cs:14:49:14:52 | access to local variable salt | StaticSalt.cs:13:39:13:54 | "Hardcoded Salt" : String | StaticSalt.cs:14:49:14:52 | access to local variable salt | Use of $@. | StaticSalt.cs:13:39:13:54 | "Hardcoded Salt" | hardcoded salt |
3+
| StaticSalt.cs:30:49:30:52 | access to local variable salt | StaticSalt.cs:23:12:23:28 | "Hardcoded Salt2" : String | StaticSalt.cs:30:49:30:52 | access to local variable salt | Use of $@. | StaticSalt.cs:23:12:23:28 | "Hardcoded Salt2" | hardcoded salt |
14
edges
25
| StaticSalt.cs:13:9:13:12 | access to local variable salt : Byte[] | StaticSalt.cs:14:49:14:52 | access to local variable salt | provenance | |
36
| StaticSalt.cs:13:16:13:55 | call to method GetBytes : Byte[] | StaticSalt.cs:13:9:13:12 | access to local variable salt : Byte[] | provenance | |
4-
| StaticSalt.cs:13:39:13:54 | "Hardcoded Salt" : String | StaticSalt.cs:13:16:13:55 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
7+
| StaticSalt.cs:13:39:13:54 | "Hardcoded Salt" : String | StaticSalt.cs:13:16:13:55 | call to method GetBytes : Byte[] | provenance | MaD:1 |
58
| StaticSalt.cs:23:12:23:28 | "Hardcoded Salt2" : String | StaticSalt.cs:29:39:29:63 | call to method generateSalt : String | provenance | |
69
| StaticSalt.cs:29:9:29:12 | access to local variable salt : Byte[] | StaticSalt.cs:30:49:30:52 | access to local variable salt | provenance | |
710
| StaticSalt.cs:29:16:29:64 | call to method GetBytes : Byte[] | StaticSalt.cs:29:9:29:12 | access to local variable salt : Byte[] | provenance | |
8-
| StaticSalt.cs:29:39:29:63 | call to method generateSalt : String | StaticSalt.cs:29:16:29:64 | call to method GetBytes : Byte[] | provenance | MaD:1869 |
11+
| StaticSalt.cs:29:39:29:63 | call to method generateSalt : String | StaticSalt.cs:29:16:29:64 | call to method GetBytes : Byte[] | provenance | MaD:1 |
12+
models
13+
| 1 | Summary: System.Text; Encoding; true; GetBytes; (System.String); ; Argument[0]; ReturnValue; taint; manual |
914
nodes
1015
| StaticSalt.cs:13:9:13:12 | access to local variable salt : Byte[] | semmle.label | access to local variable salt : Byte[] |
1116
| StaticSalt.cs:13:16:13:55 | call to method GetBytes : Byte[] | semmle.label | call to method GetBytes : Byte[] |
@@ -17,6 +22,3 @@ nodes
1722
| StaticSalt.cs:29:39:29:63 | call to method generateSalt : String | semmle.label | call to method generateSalt : String |
1823
| StaticSalt.cs:30:49:30:52 | access to local variable salt | semmle.label | access to local variable salt |
1924
subpaths
20-
#select
21-
| StaticSalt.cs:14:49:14:52 | access to local variable salt | StaticSalt.cs:13:39:13:54 | "Hardcoded Salt" : String | StaticSalt.cs:14:49:14:52 | access to local variable salt | Use of $@. | StaticSalt.cs:13:39:13:54 | "Hardcoded Salt" | hardcoded salt |
22-
| StaticSalt.cs:30:49:30:52 | access to local variable salt | StaticSalt.cs:23:12:23:28 | "Hardcoded Salt2" : String | StaticSalt.cs:30:49:30:52 | access to local variable salt | Use of $@. | StaticSalt.cs:23:12:23:28 | "Hardcoded Salt2" | hardcoded salt |
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
security/CWE-760/HardcodedSalt.ql
1+
query: security/CWE-760/HardcodedSalt.ql
2+
postprocess: TestUtilities/PrettyPrintModels.ql

0 commit comments

Comments
 (0)