File tree Expand file tree Collapse file tree 3 files changed +25
-7
lines changed
library-tests/dataflow/sources
query-tests/security/CWE-022/src Expand file tree Collapse file tree 3 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 7474| test.rs:607:21:607:41 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
7575| test.rs:608:21:608:41 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
7676| test.rs:616:21:616:41 | ...::open | Flow source 'FileSource' of type file (DEFAULT). |
77- | test.rs:648 :26:648 :53 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
78- | test.rs:667 :26:667 :61 | ...::connect_timeout | Flow source 'RemoteSource' of type remote (DEFAULT). |
79- | test.rs:719 :28:719 :57 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
80- | test.rs:801 :22:801 :49 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
81- | test.rs:827 :22:827 :50 | ...::new | Flow source 'RemoteSource' of type remote (DEFAULT). |
82- | test.rs:854 :16:854 :29 | ...::args | Flow source 'CommandLineArgs' of type commandargs (DEFAULT). |
83- | test.rs:854 :16:854 :29 | ...::args | Flow source 'CommandLineArgs' of type commandargs (DEFAULT). |
77+ | test.rs:658 :26:658 :53 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
78+ | test.rs:677 :26:677 :61 | ...::connect_timeout | Flow source 'RemoteSource' of type remote (DEFAULT). |
79+ | test.rs:729 :28:729 :57 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
80+ | test.rs:811 :22:811 :49 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
81+ | test.rs:837 :22:837 :50 | ...::new | Flow source 'RemoteSource' of type remote (DEFAULT). |
82+ | test.rs:864 :16:864 :29 | ...::args | Flow source 'CommandLineArgs' of type commandargs (DEFAULT). |
83+ | test.rs:864 :16:864 :29 | ...::args | Flow source 'CommandLineArgs' of type commandargs (DEFAULT). |
8484| test_futures_io.rs:19:15:19:32 | ...::connect | Flow source 'RemoteSource' of type remote (DEFAULT). |
8585| web_frameworks.rs:11:31:11:31 | a | Flow source 'RemoteSource' of type remote (DEFAULT). |
8686| web_frameworks.rs:11:31:11:31 | a | Flow source 'RemoteSource' of type remote (DEFAULT). |
Original file line number Diff line number Diff line change @@ -625,6 +625,16 @@ async fn test_tokio_file() -> std::io::Result<()> {
625625use async_std:: io:: ReadExt ;
626626
627627async fn test_async_std_file ( ) -> std:: io:: Result < ( ) > {
628+ // --- file ---
629+
630+ let mut file = async_std:: fs:: File :: open ( "file.txt" ) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
631+
632+ {
633+ let mut buffer = [ 0u8 ; 100 ] ;
634+ let _bytes = file. read ( & mut buffer) . await ?;
635+ sink ( & buffer) ; // $ MISSING: hasTaintFlow="file.txt"
636+ }
637+
628638 // --- OpenOptions ---
629639
630640 {
Original file line number Diff line number Diff line change @@ -124,7 +124,15 @@ fn sinks(path1: &Path, path2: &Path) {
124124 let _ = std:: fs:: File :: open ( path1) ; // $ path-injection-sink
125125 let _ = std:: fs:: File :: open_buffered ( path1) ; // $ path-injection-sink
126126 let _ = std:: fs:: OpenOptions :: new ( ) . open ( path1) ; // $ MISSING: path-injection-sink
127+
128+ let _ = tokio:: fs:: read ( path1) ; // $ MISSING: path-injection-sink
129+ let _ = tokio:: fs:: read_to_string ( path1) ; // $ MISSING: path-injection-sink
130+ let _ = tokio:: fs:: remove_file ( path1) ; // $ MISSING: path-injection-sink
127131 let _ = tokio:: fs:: OpenOptions :: new ( ) . open ( path1) ; // $ MISSING: path-injection-sink
132+
133+ let _ = async_std:: fs:: read ( path1) ; // $ MISSING: path-injection-sink
134+ let _ = async_std:: fs:: read_to_string ( path1) ; // $ MISSING: path-injection-sink
135+ let _ = async_std:: fs:: remove_file ( path1) ; // $ MISSING: path-injection-sink
128136 let _ = async_std:: fs:: OpenOptions :: new ( ) . open ( path1) ; // $ MISSING: path-injection-sink
129137}
130138
You can’t perform that action at this time.
0 commit comments