@@ -39,51 +39,51 @@ impl std::fmt::Display for MyStruct2 {
3939
4040fn test_log ( harmless : String , password : String , encrypted_password : String ) {
4141 // 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]
4848
4949 // debug! macro, various formatting
5050 debug ! ( "message" ) ;
5151 debug ! ( "message = {}" , harmless) ;
52- debug ! ( "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
52+ debug ! ( "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
5353 debug ! ( "message = {}" , encrypted_password) ;
54- debug ! ( "message = {} {}" , harmless, password) ; // $ Source Alert[rust/cleartext-logging]
54+ debug ! ( "message = {} {}" , harmless, password) ; // $ Alert[rust/cleartext-logging]
5555 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]
5959 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]
6262
6363 // log! macro, various formatting
6464 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]
6666 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]
6969
7070 // structured logging
7171 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]
7373 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]
7777 error ! ( value = password. as_str( ) ; "message" ) ; // $ MISSING: Alert[rust/cleartext-logging]
7878 error ! ( value: ? = password. as_str( ) ; "message" ) ; // $ MISSING: Alert[rust/cleartext-logging]
7979
8080 let value1 = 1 ;
8181 error ! ( value1; "message = {}" , harmless) ;
82- error ! ( value1; "message = {}" , password) ; // $ Source Alert[rust/cleartext-logging]
82+ error ! ( value1; "message = {}" , password) ; // $ Alert[rust/cleartext-logging]
8383 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]
8787
8888 let value2 = password. as_str ( ) ;
8989 error ! ( value2; "message" ) ; // $ MISSING: Alert[rust/cleartext-logging]
@@ -115,7 +115,7 @@ fn test_log(harmless: String, password: String, encrypted_password: String) {
115115 }
116116
117117 // logging with a call
118- trace ! ( "message = {}" , get_password( ) ) ; // $ Source Alert[rust/cleartext-logging]
118+ trace ! ( "message = {}" , get_password( ) ) ; // $ Alert[rust/cleartext-logging]
119119
120120 let str1 = "123456" . to_string ( ) ;
121121 trace ! ( "message = {}" , & str1) ; // $ MISSING: Alert[rust/cleartext-logging]
@@ -149,36 +149,36 @@ fn test_log(harmless: String, password: String, encrypted_password: String) {
149149}
150150
151151fn 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]
156156
157157 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]
169169 _ => { }
170170 }
171171
172172 std:: io:: stdout ( ) . lock ( ) . write_fmt ( format_args ! ( "message = {}\n " , password) ) ; // $ MISSING: Alert[rust/cleartext-logging]
173173 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]
176176
177177 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]
179179
180180 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]
182182}
183183
184184fn main ( ) {
0 commit comments