@@ -39,51 +39,51 @@ impl std::fmt::Display for MyStruct2 {
39
39
40
40
fn test_log ( harmless : String , password : String , encrypted_password : String ) {
41
41
// logging macros
42
- debug ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
43
- error ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
44
- info ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
45
- trace ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
46
- warn ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
47
- log ! ( Level :: Error , "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
42
+ debug ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
43
+ error ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
44
+ info ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
45
+ trace ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
46
+ warn ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
47
+ log ! ( Level :: Error , "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
48
48
49
49
// debug! macro, various formatting
50
50
debug ! ( "message" ) ;
51
51
debug ! ( "message = {}" , harmless) ;
52
- debug ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
52
+ debug ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
53
53
debug ! ( "message = {}" , encrypted_password) ;
54
- debug ! ( "message = {} {}" , harmless, password) ; // $ Source Alert[rust/cleartext-logging]
54
+ debug ! ( "message = {} {}" , harmless, password) ; // $ Alert[rust/cleartext-logging]
55
55
debug ! ( "message = {harmless}" ) ;
56
- debug ! ( "message = {harmless} {}" , password) ; // $ Source Alert[rust/cleartext-logging]
57
- debug ! ( "message = {password}" ) ; // $ Source Alert[rust/cleartext-logging]
58
- debug ! ( "message = {password:?}" ) ; // $ Source Alert[rust/cleartext-logging]
56
+ debug ! ( "message = {harmless} {}" , password) ; // $ Alert[rust/cleartext-logging]
57
+ debug ! ( "message = {password}" ) ; // $ Alert[rust/cleartext-logging]
58
+ debug ! ( "message = {password:?}" ) ; // $ Alert[rust/cleartext-logging]
59
59
debug ! ( target: "target" , "message = {}" , harmless) ;
60
- debug ! ( target: "target" , "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
61
- debug ! ( target: & password, "message = {}" , harmless) ; // $ Source Alert[rust/cleartext-logging]
60
+ debug ! ( target: "target" , "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
61
+ debug ! ( target: & password, "message = {}" , harmless) ; // $ Alert[rust/cleartext-logging]
62
62
63
63
// log! macro, various formatting
64
64
log ! ( Level :: Error , "message = {}" , harmless) ;
65
- log ! ( Level :: Error , "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
65
+ log ! ( Level :: Error , "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
66
66
log ! ( target: "target" , Level :: Error , "message = {}" , harmless) ;
67
- log ! ( target: "target" , Level :: Error , "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
68
- log ! ( target: & password, Level :: Error , "message = {}" , harmless) ; // $ Source Alert[rust/cleartext-logging]
67
+ log ! ( target: "target" , Level :: Error , "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
68
+ log ! ( target: & password, Level :: Error , "message = {}" , harmless) ; // $ Alert[rust/cleartext-logging]
69
69
70
70
// structured logging
71
71
error ! ( value = 1 ; "message = {}" , harmless) ;
72
- error ! ( value = 1 ; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
72
+ error ! ( value = 1 ; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
73
73
error ! ( target: "target" , value = 1 ; "message" ) ;
74
- error ! ( target: "target" , value = 1 ; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
75
- error ! ( target: & password, value = 1 ; "message" ) ; // $ Source Alert[rust/cleartext-logging]
76
- error ! ( value = 1 ; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
74
+ error ! ( target: "target" , value = 1 ; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
75
+ error ! ( target: & password, value = 1 ; "message" ) ; // $ Alert[rust/cleartext-logging]
76
+ error ! ( value = 1 ; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
77
77
error ! ( value = password. as_str( ) ; "message" ) ; // $ MISSING: Alert[rust/cleartext-logging]
78
78
error ! ( value: ? = password. as_str( ) ; "message" ) ; // $ MISSING: Alert[rust/cleartext-logging]
79
79
80
80
let value1 = 1 ;
81
81
error ! ( value1; "message = {}" , harmless) ;
82
- error ! ( value1; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
82
+ error ! ( value1; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
83
83
error ! ( target: "target" , value1; "message" ) ;
84
- error ! ( target: "target" , value1; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
85
- error ! ( target: & password, value1; "message" ) ; // $ Source Alert[rust/cleartext-logging]
86
- error ! ( value1; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
84
+ error ! ( target: "target" , value1; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
85
+ error ! ( target: & password, value1; "message" ) ; // $ Alert[rust/cleartext-logging]
86
+ error ! ( value1; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
87
87
88
88
let value2 = password. as_str ( ) ;
89
89
error ! ( value2; "message" ) ; // $ MISSING: Alert[rust/cleartext-logging]
@@ -115,7 +115,7 @@ fn test_log(harmless: String, password: String, encrypted_password: String) {
115
115
}
116
116
117
117
// logging with a call
118
- trace ! ( "message = {}" , get_password( ) ) ; // $ Source Alert[rust/cleartext-logging]
118
+ trace ! ( "message = {}" , get_password( ) ) ; // $ Alert[rust/cleartext-logging]
119
119
120
120
let str1 = "123456" . to_string ( ) ;
121
121
trace ! ( "message = {}" , & str1) ; // $ MISSING: Alert[rust/cleartext-logging]
@@ -149,36 +149,36 @@ fn test_log(harmless: String, password: String, encrypted_password: String) {
149
149
}
150
150
151
151
fn test_std ( password : String , i : i32 , opt_i : Option < i32 > ) {
152
- print ! ( "message = {}\n " , password) ; // $ Source Alert[rust/cleartext-logging]
153
- println ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
154
- eprint ! ( "message = {}\n " , password) ; // $ Source Alert[rust/cleartext-logging]
155
- eprintln ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
152
+ print ! ( "message = {}\n " , password) ; // $ Alert[rust/cleartext-logging]
153
+ println ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
154
+ eprint ! ( "message = {}\n " , password) ; // $ Alert[rust/cleartext-logging]
155
+ eprintln ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
156
156
157
157
match i {
158
- 1 => { panic ! ( "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
159
- 2 => { todo ! ( "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
160
- 3 => { unimplemented ! ( "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
161
- 4 => { unreachable ! ( "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
162
- 5 => { assert ! ( false , "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
163
- 6 => { assert_eq ! ( 1 , 2 , "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
164
- 7 => { assert_ne ! ( 1 , 1 , "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
165
- 8 => { debug_assert ! ( false , "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
166
- 9 => { debug_assert_eq ! ( 1 , 2 , "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
167
- 10 => { debug_assert_ne ! ( 1 , 1 , "message = {}" , password) ; } // $ Source Alert[rust/cleartext-logging]
168
- 11 => { _ = opt_i. expect ( format ! ( "message = {}" , password) . as_str ( ) ) ; } // $ Source Alert[rust/cleartext-logging]
158
+ 1 => { panic ! ( "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
159
+ 2 => { todo ! ( "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
160
+ 3 => { unimplemented ! ( "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
161
+ 4 => { unreachable ! ( "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
162
+ 5 => { assert ! ( false , "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
163
+ 6 => { assert_eq ! ( 1 , 2 , "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
164
+ 7 => { assert_ne ! ( 1 , 1 , "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
165
+ 8 => { debug_assert ! ( false , "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
166
+ 9 => { debug_assert_eq ! ( 1 , 2 , "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
167
+ 10 => { debug_assert_ne ! ( 1 , 1 , "message = {}" , password) ; } // $ Alert[rust/cleartext-logging]
168
+ 11 => { _ = opt_i. expect ( format ! ( "message = {}" , password) . as_str ( ) ) ; } // $ Alert[rust/cleartext-logging]
169
169
_ => { }
170
170
}
171
171
172
172
std:: io:: stdout ( ) . lock ( ) . write_fmt ( format_args ! ( "message = {}\n " , password) ) ; // $ MISSING: Alert[rust/cleartext-logging]
173
173
std:: io:: stderr ( ) . lock ( ) . write_fmt ( format_args ! ( "message = {}\n " , password) ) ; // $ MISSING: Alert[rust/cleartext-logging]
174
- std:: io:: stdout ( ) . lock ( ) . write ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Source Alert[rust/cleartext-logging]
175
- std:: io:: stdout ( ) . lock ( ) . write_all ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Source Alert[rust/cleartext-logging]
174
+ std:: io:: stdout ( ) . lock ( ) . write ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Alert[rust/cleartext-logging]
175
+ std:: io:: stdout ( ) . lock ( ) . write_all ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Alert[rust/cleartext-logging]
176
176
177
177
let mut out = std:: io:: stdout ( ) . lock ( ) ;
178
- out. write ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Source Alert[rust/cleartext-logging]
178
+ out. write ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Alert[rust/cleartext-logging]
179
179
180
180
let mut err = std:: io:: stderr ( ) . lock ( ) ;
181
- err. write ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Source Alert[rust/cleartext-logging]
181
+ err. write ( format ! ( "message = {}\n " , password) . as_bytes ( ) ) ; // $ Alert[rust/cleartext-logging]
182
182
}
183
183
184
184
fn main ( ) {
0 commit comments