@@ -434,6 +434,38 @@ fn test_fs() -> Result<(), Box<dyn std::error::Error>> {
434434 Ok ( ( ) )
435435}
436436
437+ async fn test_tokio_fs ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
438+ {
439+ let buffer: Vec < u8 > = tokio:: fs:: read ( "file.bin" ) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
440+ sink ( buffer) ; // $ MISSING: hasTaintFlow="file.bin"
441+ }
442+
443+ {
444+ let buffer: Vec < u8 > = tokio:: fs:: read ( "file.bin" ) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
445+ sink ( buffer) ; // $ MISSING: hasTaintFlow="file.bin"
446+ }
447+
448+ {
449+ let buffer = tokio:: fs:: read_to_string ( "file.txt" ) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
450+ sink ( buffer) ; // $ MISSING: hasTaintFlow="file.txt"
451+ }
452+
453+ let mut read_dir = tokio:: fs:: read_dir ( "directory" ) . await ?;
454+ for entry in read_dir. next_entry ( ) . await ? {
455+ let path = entry. path ( ) ; // $ MISSING: Alert[rust/summary/taint-sources]
456+ let file_name = entry. file_name ( ) ; // $ MISSING: Alert[rust/summary/taint-sources]
457+ sink ( path) ; // $ MISSING: hasTaintFlow
458+ sink ( file_name) ; // $ MISSING: hasTaintFlow
459+ }
460+
461+ {
462+ let target = tokio:: fs:: read_link ( "symlink.txt" ) . await ?; // $ MISSING: Alert[rust/summary/taint-sources]
463+ sink ( target) ; // $ MISSING: hasTaintFlow="symlink.txt"
464+ }
465+
466+ Ok ( ( ) )
467+ }
468+
437469fn test_io_file ( ) -> std:: io:: Result < ( ) > {
438470 // --- file ---
439471
@@ -781,6 +813,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
781813 Err ( e) => println ! ( "error: {}" , e) ,
782814 }
783815
816+ println ! ( "test_tokio_fs..." ) ;
817+ match futures:: executor:: block_on ( test_tokio_fs ( ) ) {
818+ Ok ( _) => println ! ( "complete" ) ,
819+ Err ( e) => println ! ( "error: {}" , e) ,
820+ }
821+
784822 println ! ( "test_io_file..." ) ;
785823 match test_io_file ( ) {
786824 Ok ( _) => println ! ( "complete" ) ,
0 commit comments