Skip to content

Commit 813a854

Browse files
committed
C++: accept test changes for globals in data flow
1 parent d28c39c commit 813a854

File tree

7 files changed

+77
-8
lines changed

7 files changed

+77
-8
lines changed

cpp/ql/test/query-tests/Security/CWE/CWE-497/semmle/tests/ExposedSystemData.expected

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
edges
2+
| tests2.cpp:50:13:50:19 | global1 | tests2.cpp:82:14:82:20 | global1 |
3+
| tests2.cpp:50:13:50:19 | global1 | tests2.cpp:82:14:82:20 | global1 |
4+
| tests2.cpp:50:23:50:43 | Store | tests2.cpp:50:13:50:19 | global1 |
5+
| tests2.cpp:50:23:50:43 | call to mysql_get_client_info | tests2.cpp:50:23:50:43 | Store |
26
| tests2.cpp:63:13:63:18 | call to getenv | tests2.cpp:63:13:63:26 | (const char *)... |
37
| tests2.cpp:64:13:64:18 | call to getenv | tests2.cpp:64:13:64:26 | (const char *)... |
48
| tests2.cpp:65:13:65:18 | call to getenv | tests2.cpp:65:13:65:30 | (const char *)... |
59
| tests2.cpp:66:13:66:18 | call to getenv | tests2.cpp:66:13:66:34 | (const char *)... |
610
| tests2.cpp:78:18:78:38 | call to mysql_get_client_info | tests2.cpp:81:14:81:19 | (const char *)... |
711
| tests2.cpp:80:14:80:34 | call to mysql_get_client_info | tests2.cpp:80:14:80:34 | call to mysql_get_client_info |
812
| tests2.cpp:80:14:80:34 | call to mysql_get_client_info | tests2.cpp:80:14:80:34 | call to mysql_get_client_info |
13+
| tests2.cpp:82:14:82:20 | global1 | tests2.cpp:82:14:82:20 | global1 |
14+
| tests2.cpp:82:14:82:20 | global1 | tests2.cpp:82:14:82:20 | global1 |
915
| tests2.cpp:91:42:91:45 | str1 | tests2.cpp:93:14:93:17 | str1 |
1016
| tests2.cpp:101:8:101:15 | call to getpwuid | tests2.cpp:102:14:102:15 | pw |
1117
| tests2.cpp:109:3:109:4 | c1 [post update] [ptr] | tests2.cpp:111:14:111:15 | c1 [read] [ptr] |
@@ -23,6 +29,9 @@ edges
2329
| tests_sysconf.cpp:36:21:36:27 | confstr output argument | tests_sysconf.cpp:39:19:39:25 | (const void *)... |
2430
| tests_sysconf.cpp:36:21:36:27 | confstr output argument | tests_sysconf.cpp:39:19:39:25 | pathbuf |
2531
nodes
32+
| tests2.cpp:50:13:50:19 | global1 | semmle.label | global1 |
33+
| tests2.cpp:50:23:50:43 | Store | semmle.label | Store |
34+
| tests2.cpp:50:23:50:43 | call to mysql_get_client_info | semmle.label | call to mysql_get_client_info |
2635
| tests2.cpp:63:13:63:18 | call to getenv | semmle.label | call to getenv |
2736
| tests2.cpp:63:13:63:18 | call to getenv | semmle.label | call to getenv |
2837
| tests2.cpp:63:13:63:26 | (const char *)... | semmle.label | (const char *)... |
@@ -39,6 +48,8 @@ nodes
3948
| tests2.cpp:80:14:80:34 | call to mysql_get_client_info | semmle.label | call to mysql_get_client_info |
4049
| tests2.cpp:80:14:80:34 | call to mysql_get_client_info | semmle.label | call to mysql_get_client_info |
4150
| tests2.cpp:81:14:81:19 | (const char *)... | semmle.label | (const char *)... |
51+
| tests2.cpp:82:14:82:20 | global1 | semmle.label | global1 |
52+
| tests2.cpp:82:14:82:20 | global1 | semmle.label | global1 |
4253
| tests2.cpp:91:42:91:45 | str1 | semmle.label | str1 |
4354
| tests2.cpp:93:14:93:17 | str1 | semmle.label | str1 |
4455
| tests2.cpp:101:8:101:15 | call to getpwuid | semmle.label | call to getpwuid |
@@ -70,6 +81,7 @@ subpaths
7081
| tests2.cpp:80:14:80:34 | call to mysql_get_client_info | tests2.cpp:80:14:80:34 | call to mysql_get_client_info | tests2.cpp:80:14:80:34 | call to mysql_get_client_info | This operation exposes system data from $@. | tests2.cpp:80:14:80:34 | call to mysql_get_client_info | call to mysql_get_client_info |
7182
| tests2.cpp:80:14:80:34 | call to mysql_get_client_info | tests2.cpp:80:14:80:34 | call to mysql_get_client_info | tests2.cpp:80:14:80:34 | call to mysql_get_client_info | This operation exposes system data from $@. | tests2.cpp:80:14:80:34 | call to mysql_get_client_info | call to mysql_get_client_info |
7283
| tests2.cpp:81:14:81:19 | (const char *)... | tests2.cpp:78:18:78:38 | call to mysql_get_client_info | tests2.cpp:81:14:81:19 | (const char *)... | This operation exposes system data from $@. | tests2.cpp:78:18:78:38 | call to mysql_get_client_info | call to mysql_get_client_info |
84+
| tests2.cpp:82:14:82:20 | global1 | tests2.cpp:50:23:50:43 | call to mysql_get_client_info | tests2.cpp:82:14:82:20 | global1 | This operation exposes system data from $@. | tests2.cpp:50:23:50:43 | call to mysql_get_client_info | call to mysql_get_client_info |
7385
| tests2.cpp:93:14:93:17 | str1 | tests2.cpp:91:42:91:45 | str1 | tests2.cpp:93:14:93:17 | str1 | This operation exposes system data from $@. | tests2.cpp:91:42:91:45 | str1 | str1 |
7486
| tests2.cpp:102:14:102:15 | pw | tests2.cpp:101:8:101:15 | call to getpwuid | tests2.cpp:102:14:102:15 | pw | This operation exposes system data from $@. | tests2.cpp:101:8:101:15 | call to getpwuid | call to getpwuid |
7587
| tests2.cpp:111:14:111:19 | (const char *)... | tests2.cpp:109:12:109:17 | call to getenv | tests2.cpp:111:14:111:19 | (const char *)... | This operation exposes system data from $@. | tests2.cpp:109:12:109:17 | call to getenv | call to getenv |

cpp/ql/test/query-tests/Security/CWE/CWE-497/semmle/tests/PotentiallyExposedSystemData.expected

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ edges
55
| tests.cpp:57:18:57:23 | call to getenv | tests.cpp:57:18:57:39 | (const char_type *)... |
66
| tests.cpp:58:41:58:46 | call to getenv | tests.cpp:58:41:58:62 | (const char_type *)... |
77
| tests.cpp:59:43:59:48 | call to getenv | tests.cpp:59:43:59:64 | (const char *)... |
8+
| tests.cpp:62:7:62:18 | global_token | tests.cpp:69:17:69:28 | global_token |
9+
| tests.cpp:62:7:62:18 | global_token | tests.cpp:71:27:71:38 | global_token |
10+
| tests.cpp:62:7:62:18 | global_token | tests.cpp:71:27:71:38 | global_token |
11+
| tests.cpp:62:22:62:27 | Store | tests.cpp:62:7:62:18 | global_token |
12+
| tests.cpp:62:22:62:27 | call to getenv | tests.cpp:62:22:62:27 | Store |
13+
| tests.cpp:69:17:69:28 | global_token | tests.cpp:73:27:73:31 | maybe |
14+
| tests.cpp:71:27:71:38 | global_token | tests.cpp:71:27:71:38 | global_token |
15+
| tests.cpp:71:27:71:38 | global_token | tests.cpp:71:27:71:38 | global_token |
816
| tests.cpp:86:29:86:31 | *msg | tests.cpp:88:15:88:17 | msg |
917
| tests.cpp:86:29:86:31 | msg | tests.cpp:88:15:88:17 | msg |
1018
| tests.cpp:97:13:97:18 | call to getenv | tests.cpp:97:13:97:34 | (const char *)... |
@@ -52,6 +60,13 @@ nodes
5260
| tests.cpp:59:43:59:48 | call to getenv | semmle.label | call to getenv |
5361
| tests.cpp:59:43:59:48 | call to getenv | semmle.label | call to getenv |
5462
| tests.cpp:59:43:59:64 | (const char *)... | semmle.label | (const char *)... |
63+
| tests.cpp:62:7:62:18 | global_token | semmle.label | global_token |
64+
| tests.cpp:62:22:62:27 | Store | semmle.label | Store |
65+
| tests.cpp:62:22:62:27 | call to getenv | semmle.label | call to getenv |
66+
| tests.cpp:69:17:69:28 | global_token | semmle.label | global_token |
67+
| tests.cpp:71:27:71:38 | global_token | semmle.label | global_token |
68+
| tests.cpp:71:27:71:38 | global_token | semmle.label | global_token |
69+
| tests.cpp:73:27:73:31 | maybe | semmle.label | maybe |
5570
| tests.cpp:86:29:86:31 | *msg | semmle.label | *msg |
5671
| tests.cpp:86:29:86:31 | msg | semmle.label | msg |
5772
| tests.cpp:88:15:88:17 | msg | semmle.label | msg |
@@ -97,6 +112,8 @@ subpaths
97112
| tests.cpp:58:41:58:62 | (const char_type *)... | tests.cpp:58:41:58:46 | call to getenv | tests.cpp:58:41:58:62 | (const char_type *)... | This operation potentially exposes sensitive system data from $@. | tests.cpp:58:41:58:46 | call to getenv | call to getenv |
98113
| tests.cpp:59:43:59:48 | call to getenv | tests.cpp:59:43:59:48 | call to getenv | tests.cpp:59:43:59:48 | call to getenv | This operation potentially exposes sensitive system data from $@. | tests.cpp:59:43:59:48 | call to getenv | call to getenv |
99114
| tests.cpp:59:43:59:64 | (const char *)... | tests.cpp:59:43:59:48 | call to getenv | tests.cpp:59:43:59:64 | (const char *)... | This operation potentially exposes sensitive system data from $@. | tests.cpp:59:43:59:48 | call to getenv | call to getenv |
115+
| tests.cpp:71:27:71:38 | global_token | tests.cpp:62:22:62:27 | call to getenv | tests.cpp:71:27:71:38 | global_token | This operation potentially exposes sensitive system data from $@. | tests.cpp:62:22:62:27 | call to getenv | call to getenv |
116+
| tests.cpp:73:27:73:31 | maybe | tests.cpp:62:22:62:27 | call to getenv | tests.cpp:73:27:73:31 | maybe | This operation potentially exposes sensitive system data from $@. | tests.cpp:62:22:62:27 | call to getenv | call to getenv |
100117
| tests.cpp:88:15:88:17 | msg | tests.cpp:97:13:97:18 | call to getenv | tests.cpp:88:15:88:17 | msg | This operation potentially exposes sensitive system data from $@. | tests.cpp:97:13:97:18 | call to getenv | call to getenv |
101118
| tests.cpp:97:13:97:18 | call to getenv | tests.cpp:97:13:97:18 | call to getenv | tests.cpp:97:13:97:18 | call to getenv | This operation potentially exposes sensitive system data from $@. | tests.cpp:97:13:97:18 | call to getenv | call to getenv |
102119
| tests.cpp:97:13:97:34 | (const char *)... | tests.cpp:97:13:97:18 | call to getenv | tests.cpp:97:13:97:34 | (const char *)... | This operation potentially exposes sensitive system data from $@. | tests.cpp:97:13:97:18 | call to getenv | call to getenv |

cpp/ql/test/query-tests/Security/CWE/CWE-497/semmle/tests/tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ void test2(bool cond)
6868

6969
maybe = cond ? global_token : global_other;
7070

71-
printf("token = '%s'\n", global_token); // BAD: outputs SECRET_TOKEN environment variable [NOT DETECTED]
71+
printf("token = '%s'\n", global_token); // BAD: outputs SECRET_TOKEN environment variable
7272
printf("other = '%s'\n", global_other);
73-
printf("maybe = '%s'\n", maybe); // BAD: may output SECRET_TOKEN environment variable [NOT DETECTED]
73+
printf("maybe = '%s'\n", maybe); // BAD: may output SECRET_TOKEN environment variable
7474
}
7575

7676
void test3()

cpp/ql/test/query-tests/Security/CWE/CWE-497/semmle/tests/tests2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void test1()
7979

8080
send(sock, mysql_get_client_info(), val(), val()); // BAD
8181
send(sock, buffer, val(), val()); // BAD
82-
send(sock, global1, val(), val()); // BAD [NOT DETECTED]
82+
send(sock, global1, val(), val()); // BAD
8383
send(sock, global2, val(), val()); // GOOD: not system data
8484
}
8585

cpp/ql/test/query-tests/Security/CWE/CWE-611/XXE.expected

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,26 @@ edges
22
| tests2.cpp:20:17:20:31 | SAXParser output argument | tests2.cpp:22:2:22:2 | p |
33
| tests2.cpp:33:17:33:31 | SAXParser output argument | tests2.cpp:37:2:37:2 | p |
44
| tests3.cpp:23:21:23:53 | call to createXMLReader | tests3.cpp:25:2:25:2 | p |
5+
| tests3.cpp:35:16:35:20 | p_3_3 | tests3.cpp:38:2:38:6 | p_3_3 |
6+
| tests3.cpp:35:24:35:56 | Store | tests3.cpp:35:16:35:20 | p_3_3 |
7+
| tests3.cpp:35:24:35:56 | call to createXMLReader | tests3.cpp:35:24:35:56 | Store |
8+
| tests3.cpp:41:16:41:20 | p_3_4 | tests3.cpp:45:2:45:6 | p_3_4 |
9+
| tests3.cpp:41:24:41:56 | Store | tests3.cpp:41:16:41:20 | p_3_4 |
10+
| tests3.cpp:41:24:41:56 | call to createXMLReader | tests3.cpp:41:24:41:56 | Store |
11+
| tests3.cpp:48:16:48:20 | p_3_5 | tests3.cpp:56:2:56:6 | p_3_5 |
12+
| tests3.cpp:48:24:48:56 | Store | tests3.cpp:48:16:48:20 | p_3_5 |
13+
| tests3.cpp:48:24:48:56 | call to createXMLReader | tests3.cpp:48:24:48:56 | Store |
514
| tests3.cpp:60:21:60:53 | call to createXMLReader | tests3.cpp:63:2:63:2 | p |
615
| tests3.cpp:67:21:67:53 | call to createXMLReader | tests3.cpp:70:2:70:2 | p |
716
| tests5.cpp:27:25:27:38 | call to createLSParser | tests5.cpp:29:2:29:2 | p |
817
| tests5.cpp:40:25:40:38 | call to createLSParser | tests5.cpp:43:2:43:2 | p |
918
| tests5.cpp:55:25:55:38 | call to createLSParser | tests5.cpp:59:2:59:2 | p |
19+
| tests5.cpp:63:14:63:17 | g_p1 | tests5.cpp:76:2:76:5 | g_p1 |
20+
| tests5.cpp:63:21:63:24 | g_p2 | tests5.cpp:77:2:77:5 | g_p2 |
21+
| tests5.cpp:67:2:67:32 | Store | tests5.cpp:63:14:63:17 | g_p1 |
22+
| tests5.cpp:67:17:67:30 | call to createLSParser | tests5.cpp:67:2:67:32 | Store |
23+
| tests5.cpp:70:2:70:32 | Store | tests5.cpp:63:21:63:24 | g_p2 |
24+
| tests5.cpp:70:17:70:30 | call to createLSParser | tests5.cpp:70:2:70:32 | Store |
1025
| tests5.cpp:81:25:81:38 | call to createLSParser | tests5.cpp:83:2:83:2 | p |
1126
| tests5.cpp:81:25:81:38 | call to createLSParser | tests5.cpp:83:2:83:2 | p |
1227
| tests5.cpp:83:2:83:2 | p | tests5.cpp:85:2:85:2 | p |
@@ -46,6 +61,18 @@ nodes
4661
| tests2.cpp:37:2:37:2 | p | semmle.label | p |
4762
| tests3.cpp:23:21:23:53 | call to createXMLReader | semmle.label | call to createXMLReader |
4863
| tests3.cpp:25:2:25:2 | p | semmle.label | p |
64+
| tests3.cpp:35:16:35:20 | p_3_3 | semmle.label | p_3_3 |
65+
| tests3.cpp:35:24:35:56 | Store | semmle.label | Store |
66+
| tests3.cpp:35:24:35:56 | call to createXMLReader | semmle.label | call to createXMLReader |
67+
| tests3.cpp:38:2:38:6 | p_3_3 | semmle.label | p_3_3 |
68+
| tests3.cpp:41:16:41:20 | p_3_4 | semmle.label | p_3_4 |
69+
| tests3.cpp:41:24:41:56 | Store | semmle.label | Store |
70+
| tests3.cpp:41:24:41:56 | call to createXMLReader | semmle.label | call to createXMLReader |
71+
| tests3.cpp:45:2:45:6 | p_3_4 | semmle.label | p_3_4 |
72+
| tests3.cpp:48:16:48:20 | p_3_5 | semmle.label | p_3_5 |
73+
| tests3.cpp:48:24:48:56 | Store | semmle.label | Store |
74+
| tests3.cpp:48:24:48:56 | call to createXMLReader | semmle.label | call to createXMLReader |
75+
| tests3.cpp:56:2:56:6 | p_3_5 | semmle.label | p_3_5 |
4976
| tests3.cpp:60:21:60:53 | call to createXMLReader | semmle.label | call to createXMLReader |
5077
| tests3.cpp:63:2:63:2 | p | semmle.label | p |
5178
| tests3.cpp:67:21:67:53 | call to createXMLReader | semmle.label | call to createXMLReader |
@@ -61,6 +88,14 @@ nodes
6188
| tests5.cpp:43:2:43:2 | p | semmle.label | p |
6289
| tests5.cpp:55:25:55:38 | call to createLSParser | semmle.label | call to createLSParser |
6390
| tests5.cpp:59:2:59:2 | p | semmle.label | p |
91+
| tests5.cpp:63:14:63:17 | g_p1 | semmle.label | g_p1 |
92+
| tests5.cpp:63:21:63:24 | g_p2 | semmle.label | g_p2 |
93+
| tests5.cpp:67:2:67:32 | Store | semmle.label | Store |
94+
| tests5.cpp:67:17:67:30 | call to createLSParser | semmle.label | call to createLSParser |
95+
| tests5.cpp:70:2:70:32 | Store | semmle.label | Store |
96+
| tests5.cpp:70:17:70:30 | call to createLSParser | semmle.label | call to createLSParser |
97+
| tests5.cpp:76:2:76:5 | g_p1 | semmle.label | g_p1 |
98+
| tests5.cpp:77:2:77:5 | g_p2 | semmle.label | g_p2 |
6499
| tests5.cpp:81:25:81:38 | call to createLSParser | semmle.label | call to createLSParser |
65100
| tests5.cpp:83:2:83:2 | p | semmle.label | p |
66101
| tests5.cpp:83:2:83:2 | p | semmle.label | p |
@@ -108,6 +143,9 @@ subpaths
108143
| tests2.cpp:22:2:22:2 | p | tests2.cpp:20:17:20:31 | SAXParser output argument | tests2.cpp:22:2:22:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests2.cpp:20:17:20:31 | SAXParser output argument | XML parser |
109144
| tests2.cpp:37:2:37:2 | p | tests2.cpp:33:17:33:31 | SAXParser output argument | tests2.cpp:37:2:37:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests2.cpp:33:17:33:31 | SAXParser output argument | XML parser |
110145
| tests3.cpp:25:2:25:2 | p | tests3.cpp:23:21:23:53 | call to createXMLReader | tests3.cpp:25:2:25:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests3.cpp:23:21:23:53 | call to createXMLReader | XML parser |
146+
| tests3.cpp:38:2:38:6 | p_3_3 | tests3.cpp:35:24:35:56 | call to createXMLReader | tests3.cpp:38:2:38:6 | p_3_3 | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests3.cpp:35:24:35:56 | call to createXMLReader | XML parser |
147+
| tests3.cpp:45:2:45:6 | p_3_4 | tests3.cpp:41:24:41:56 | call to createXMLReader | tests3.cpp:45:2:45:6 | p_3_4 | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests3.cpp:41:24:41:56 | call to createXMLReader | XML parser |
148+
| tests3.cpp:56:2:56:6 | p_3_5 | tests3.cpp:48:24:48:56 | call to createXMLReader | tests3.cpp:56:2:56:6 | p_3_5 | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests3.cpp:48:24:48:56 | call to createXMLReader | XML parser |
111149
| tests3.cpp:63:2:63:2 | p | tests3.cpp:60:21:60:53 | call to createXMLReader | tests3.cpp:63:2:63:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests3.cpp:60:21:60:53 | call to createXMLReader | XML parser |
112150
| tests3.cpp:70:2:70:2 | p | tests3.cpp:67:21:67:53 | call to createXMLReader | tests3.cpp:70:2:70:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests3.cpp:67:21:67:53 | call to createXMLReader | XML parser |
113151
| tests4.cpp:26:34:26:48 | (int)... | tests4.cpp:26:34:26:48 | (int)... | tests4.cpp:26:34:26:48 | (int)... | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests4.cpp:26:34:26:48 | (int)... | XML parser |
@@ -118,6 +156,8 @@ subpaths
118156
| tests5.cpp:29:2:29:2 | p | tests5.cpp:27:25:27:38 | call to createLSParser | tests5.cpp:29:2:29:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:27:25:27:38 | call to createLSParser | XML parser |
119157
| tests5.cpp:43:2:43:2 | p | tests5.cpp:40:25:40:38 | call to createLSParser | tests5.cpp:43:2:43:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:40:25:40:38 | call to createLSParser | XML parser |
120158
| tests5.cpp:59:2:59:2 | p | tests5.cpp:55:25:55:38 | call to createLSParser | tests5.cpp:59:2:59:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:55:25:55:38 | call to createLSParser | XML parser |
159+
| tests5.cpp:76:2:76:5 | g_p1 | tests5.cpp:67:17:67:30 | call to createLSParser | tests5.cpp:76:2:76:5 | g_p1 | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:67:17:67:30 | call to createLSParser | XML parser |
160+
| tests5.cpp:77:2:77:5 | g_p2 | tests5.cpp:70:17:70:30 | call to createLSParser | tests5.cpp:77:2:77:5 | g_p2 | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:70:17:70:30 | call to createLSParser | XML parser |
121161
| tests5.cpp:83:2:83:2 | p | tests5.cpp:81:25:81:38 | call to createLSParser | tests5.cpp:83:2:83:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:81:25:81:38 | call to createLSParser | XML parser |
122162
| tests5.cpp:89:2:89:2 | p | tests5.cpp:81:25:81:38 | call to createLSParser | tests5.cpp:89:2:89:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests5.cpp:81:25:81:38 | call to createLSParser | XML parser |
123163
| tests.cpp:17:2:17:2 | p | tests.cpp:15:23:15:43 | XercesDOMParser output argument | tests.cpp:17:2:17:2 | p | This $@ is not configured to prevent an XML external entity (XXE) attack. | tests.cpp:15:23:15:43 | XercesDOMParser output argument | XML parser |

cpp/ql/test/query-tests/Security/CWE/CWE-611/tests3.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ void test3_2(InputSource &data) {
3535
SAX2XMLReader *p_3_3 = XMLReaderFactory::createXMLReader();
3636

3737
void test3_3(InputSource &data) {
38-
p_3_3->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
38+
p_3_3->parse(data); // BAD (parser not correctly configured)
3939
}
4040

4141
SAX2XMLReader *p_3_4 = XMLReaderFactory::createXMLReader();
4242

4343
void test3_4(InputSource &data) {
4444
p_3_4->setFeature(XMLUni::fgXercesDisableDefaultEntityResolution, true);
45-
p_3_4->parse(data); // GOOD
45+
p_3_4->parse(data); // GOOD [FALSE POSITIVE]
4646
}
4747

4848
SAX2XMLReader *p_3_5 = XMLReaderFactory::createXMLReader();
@@ -53,7 +53,7 @@ void test3_5_init() {
5353

5454
void test3_5(InputSource &data) {
5555
test3_5_init();
56-
p_3_5->parse(data); // GOOD
56+
p_3_5->parse(data); // GOOD [FALSE POSITIVE]
5757
}
5858

5959
void test3_6(InputSource &data) {

cpp/ql/test/query-tests/Security/CWE/CWE-611/tests5.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ void test5_6_init() {
7373
void test5_6() {
7474
test5_6_init();
7575

76-
g_p1->parse(*g_data); // GOOD
77-
g_p2->parse(*g_data); // BAD (parser not correctly configured) [NOT DETECTED]
76+
g_p1->parse(*g_data); // GOOD [FALSE POSITIVE]
77+
g_p2->parse(*g_data); // BAD (parser not correctly configured)
7878
}
7979

8080
void test5_7(DOMImplementationLS *impl, InputSource &data) {

0 commit comments

Comments
 (0)