Skip to content

Commit d02d5c5

Browse files
committed
Rust: Update cleartext logging test with new found results.
1 parent 5f5d6f6 commit d02d5c5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

rust/ql/test/query-tests/security/CWE-312/CleartextLogging.expected

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
| test_logging.rs:100:5:100:19 | ...::log | test_logging.rs:99:38:99:45 | password | test_logging.rs:100:5:100:19 | ...::log | This operation writes $@ to a log file. | test_logging.rs:99:38:99:45 | password | password |
2929
| test_logging.rs:118:5:118:42 | ...::log | test_logging.rs:118:28:118:41 | get_password(...) | test_logging.rs:118:5:118:42 | ...::log | This operation writes $@ to a log file. | test_logging.rs:118:28:118:41 | get_password(...) | get_password(...) |
3030
| test_logging.rs:131:5:131:32 | ...::log | test_logging.rs:129:25:129:32 | password | test_logging.rs:131:5:131:32 | ...::log | This operation writes $@ to a log file. | test_logging.rs:129:25:129:32 | password | password |
31+
| test_logging.rs:138:5:138:38 | ...::log | test_logging.rs:138:11:138:37 | MacroExpr | test_logging.rs:138:5:138:38 | ...::log | This operation writes $@ to a log file. | test_logging.rs:138:11:138:37 | MacroExpr | MacroExpr |
32+
| test_logging.rs:145:5:145:38 | ...::log | test_logging.rs:145:11:145:37 | MacroExpr | test_logging.rs:145:5:145:38 | ...::log | This operation writes $@ to a log file. | test_logging.rs:145:11:145:37 | MacroExpr | MacroExpr |
3133
| test_logging.rs:152:5:152:38 | ...::_print | test_logging.rs:152:30:152:37 | password | test_logging.rs:152:5:152:38 | ...::_print | This operation writes $@ to a log file. | test_logging.rs:152:30:152:37 | password | password |
3234
| test_logging.rs:153:5:153:38 | ...::_print | test_logging.rs:153:30:153:37 | password | test_logging.rs:153:5:153:38 | ...::_print | This operation writes $@ to a log file. | test_logging.rs:153:30:153:37 | password | password |
3335
| test_logging.rs:154:5:154:39 | ...::_eprint | test_logging.rs:154:31:154:38 | password | test_logging.rs:154:5:154:39 | ...::_eprint | This operation writes $@ to a log file. | test_logging.rs:154:31:154:38 | password | password |
@@ -148,6 +150,8 @@ edges
148150
| test_logging.rs:131:12:131:31 | MacroExpr | test_logging.rs:131:5:131:32 | ...::log | provenance | MaD:9 Sink:MaD:9 |
149151
| test_logging.rs:131:28:131:29 | t1 [tuple.1] | test_logging.rs:131:28:131:31 | t1.1 | provenance | |
150152
| test_logging.rs:131:28:131:31 | t1.1 | test_logging.rs:131:12:131:31 | MacroExpr | provenance | |
153+
| test_logging.rs:138:11:138:37 | MacroExpr | test_logging.rs:138:5:138:38 | ...::log | provenance | MaD:9 Sink:MaD:9 |
154+
| test_logging.rs:145:11:145:37 | MacroExpr | test_logging.rs:145:5:145:38 | ...::log | provenance | MaD:9 Sink:MaD:9 |
151155
| test_logging.rs:152:12:152:37 | MacroExpr | test_logging.rs:152:5:152:38 | ...::_print | provenance | MaD:8 Sink:MaD:8 |
152156
| test_logging.rs:152:30:152:37 | password | test_logging.rs:152:12:152:37 | MacroExpr | provenance | |
153157
| test_logging.rs:153:14:153:37 | MacroExpr | test_logging.rs:153:5:153:38 | ...::_print | provenance | MaD:8 Sink:MaD:8 |
@@ -352,6 +356,10 @@ nodes
352356
| test_logging.rs:131:12:131:31 | MacroExpr | semmle.label | MacroExpr |
353357
| test_logging.rs:131:28:131:29 | t1 [tuple.1] | semmle.label | t1 [tuple.1] |
354358
| test_logging.rs:131:28:131:31 | t1.1 | semmle.label | t1.1 |
359+
| test_logging.rs:138:5:138:38 | ...::log | semmle.label | ...::log |
360+
| test_logging.rs:138:11:138:37 | MacroExpr | semmle.label | MacroExpr |
361+
| test_logging.rs:145:5:145:38 | ...::log | semmle.label | ...::log |
362+
| test_logging.rs:145:11:145:37 | MacroExpr | semmle.label | MacroExpr |
355363
| test_logging.rs:152:5:152:38 | ...::_print | semmle.label | ...::_print |
356364
| test_logging.rs:152:12:152:37 | MacroExpr | semmle.label | MacroExpr |
357365
| test_logging.rs:152:30:152:37 | password | semmle.label | password |

rust/ql/test/query-tests/security/CWE-312/test_logging.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ fn test_log(harmless: String, password: String, encrypted_password: String) {
135135
// logging from a struct
136136
let s1 = MyStruct1 { harmless: "foo".to_string(), password: "123456".to_string() }; // $ MISSING: Source=s1
137137
warn!("message = {}", s1.harmless);
138-
warn!("message = {}", s1.password); // $ MISSING: Alert[rust/cleartext-logging]
138+
warn!("message = {}", s1.password); // $ Alert[rust/cleartext-logging]
139139
warn!("message = {}", s1); // $ MISSING: Alert[rust/cleartext-logging]=s1
140140
warn!("message = {:?}", s1); // $ MISSING: Alert[rust/cleartext-logging]=s1
141141
warn!("message = {:#?}", s1); // $ MISSING: Alert[rust/cleartext-logging]=s1
142142

143143
let s2 = MyStruct2 { harmless: "foo".to_string(), password: "123456".to_string() }; // $ MISSING: Source=s2
144144
warn!("message = {}", s2.harmless);
145-
warn!("message = {}", s2.password); // $ MISSING: Alert[rust/cleartext-logging]
145+
warn!("message = {}", s2.password); // $ Alert[rust/cleartext-logging]
146146
warn!("message = {}", s2); // (this implementation does not output the password field)
147147
warn!("message = {:?}", s2); // $ MISSING: Alert[rust/cleartext-logging]=s2
148148
warn!("message = {:#?}", s2); // $ MISSING: Alert[rust/cleartext-logging]=s2

0 commit comments

Comments
 (0)