From 0cc9331abf04b18c5452a2b238203b303b5f7086 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Tue, 21 Oct 2025 15:49:37 +0100 Subject: [PATCH] Rust: Split off sources/file test. --- .../dataflow/sources/file/Cargo.lock | 802 ++++++++++++++++++ .../dataflow/sources/file/InlineFlow.expected | 537 ++++++++++++ .../dataflow/sources/file/InlineFlow.ql | 36 + .../sources/file/TaintSources.expected | 33 + .../dataflow/sources/file/TaintSources.qlref | 2 + .../dataflow/sources/file/options.yml | 6 + .../dataflow/sources/file/test.rs | 315 +++++++ .../dataflow/sources/options.yml | 1 - .../library-tests/dataflow/sources/test.rs | 306 ------- 9 files changed, 1731 insertions(+), 307 deletions(-) create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/Cargo.lock create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.expected create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.ql create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/TaintSources.expected create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/TaintSources.qlref create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/options.yml create mode 100644 rust/ql/test/library-tests/dataflow/sources/file/test.rs diff --git a/rust/ql/test/library-tests/dataflow/sources/file/Cargo.lock b/rust/ql/test/library-tests/dataflow/sources/file/Cargo.lock new file mode 100644 index 00000000000..55ccd96372e --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/Cargo.lock @@ -0,0 +1,802 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.5.0", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" +dependencies = [ + "event-listener 5.4.1", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-std" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" +dependencies = [ + "async-channel 1.9.0", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "blocking" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +dependencies = [ + "async-channel 2.5.0", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener 5.4.1", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "js-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +dependencies = [ + "value-bag", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mio" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rustix" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "syn" +version = "2.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "test" +version = "0.0.1" +dependencies = [ + "async-std", + "bytes", + "futures", + "tokio", +] + +[[package]] +name = "tokio" +version = "1.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" + +[[package]] +name = "value-bag" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" diff --git a/rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.expected b/rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.expected new file mode 100644 index 00000000000..f3a906bc2c6 --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.expected @@ -0,0 +1,537 @@ +models +| 1 | Source: ::open; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 2 | Source: ::open; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 3 | Source: ::file_name; ReturnValue; file | +| 4 | Source: ::path; ReturnValue; file | +| 5 | Source: ::open; ReturnValue.Field[core::result::Result::Ok(0)]; file | +| 6 | Source: ::open; ReturnValue.Field[core::result::Result::Ok(0)]; file | +| 7 | Source: ::open; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 8 | Source: ::open; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 9 | Source: ::file_name; ReturnValue; file | +| 10 | Source: ::path; ReturnValue; file | +| 11 | Source: std::fs::read; ReturnValue.Field[core::result::Result::Ok(0)]; file | +| 12 | Source: std::fs::read; ReturnValue; file | +| 13 | Source: std::fs::read_link; ReturnValue.Field[core::result::Result::Ok(0)]; file | +| 14 | Source: std::fs::read_to_string; ReturnValue.Field[core::result::Result::Ok(0)]; file | +| 15 | Source: std::fs::read_to_string; ReturnValue; file | +| 16 | Source: tokio::fs::read::read; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 17 | Source: tokio::fs::read_link::read_link; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 18 | Source: tokio::fs::read_to_string::read_to_string; ReturnValue.Future.Field[core::result::Result::Ok(0)]; file | +| 19 | Summary: <_ as async_std::io::read::ReadExt>::read; Argument[self].Reference; Argument[0].Reference; taint | +| 20 | Summary: <_ as async_std::io::read::ReadExt>::read; Argument[self]; Argument[0].Reference; taint | +| 21 | Summary: <_ as core::clone::Clone>::clone; Argument[self].Reference; ReturnValue; value | +| 22 | Summary: <_ as futures_util::io::AsyncReadExt>::read; Argument[self].Reference; Argument[0].Reference; taint | +| 23 | Summary: <_ as futures_util::io::AsyncReadExt>::read; Argument[self]; Argument[0].Reference; taint | +| 24 | Summary: <_ as std::io::Read>::bytes; Argument[self]; ReturnValue; taint | +| 25 | Summary: <_ as std::io::Read>::chain; Argument[0]; ReturnValue; taint | +| 26 | Summary: <_ as std::io::Read>::chain; Argument[self]; ReturnValue; taint | +| 27 | Summary: <_ as std::io::Read>::read; Argument[self]; Argument[0].Reference; taint | +| 28 | Summary: <_ as std::io::Read>::read_exact; Argument[self]; Argument[0].Reference; taint | +| 29 | Summary: <_ as std::io::Read>::read_to_end; Argument[self]; Argument[0].Reference; taint | +| 30 | Summary: <_ as std::io::Read>::read_to_string; Argument[self]; Argument[0].Reference; taint | +| 31 | Summary: <_ as std::io::Read>::take; Argument[self]; ReturnValue; taint | +| 32 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read; Argument[self]; Argument[0].Reference; taint | +| 33 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_buf; Argument[self]; Argument[0].Reference; taint | +| 34 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_exact; Argument[self]; Argument[0].Reference; taint | +| 35 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_f32; Argument[self]; ReturnValue.Future.Field[core::result::Result::Ok(0)]; taint | +| 36 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_i16; Argument[self]; ReturnValue.Future.Field[core::result::Result::Ok(0)]; taint | +| 37 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_i64_le; Argument[self]; ReturnValue.Future.Field[core::result::Result::Ok(0)]; taint | +| 38 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_to_end; Argument[self]; Argument[0].Reference; taint | +| 39 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_to_string; Argument[self]; Argument[0].Reference; taint | +| 40 | Summary: <_ as tokio::io::util::async_read_ext::AsyncReadExt>::read_u8; Argument[self]; ReturnValue.Future.Field[core::result::Result::Ok(0)]; taint | +| 41 | Summary: ::unwrap; Argument[self].Field[core::result::Result::Ok(0)]; ReturnValue; value | +| 42 | Summary: ::read; Argument[self]; Argument[0]; taint | +| 43 | Summary: ::read_to_end; Argument[self]; Argument[0]; taint | +| 44 | Summary: ::read_to_string; Argument[self]; Argument[0]; taint | +| 45 | Summary: ::as_path; Argument[self]; ReturnValue; value | +edges +| test.rs:12:13:12:18 | buffer | test.rs:13:14:13:19 | buffer | provenance | | +| test.rs:12:31:12:43 | ...::read | test.rs:12:31:12:43 | ...::read [Ok] | provenance | Src:MaD:11 | +| test.rs:12:31:12:43 | ...::read | test.rs:12:31:12:55 | ...::read(...) [Ok] | provenance | Src:MaD:11 | +| test.rs:12:31:12:43 | ...::read [Ok] | test.rs:12:31:12:55 | ...::read(...) [Ok] | provenance | MaD:12 | +| test.rs:12:31:12:55 | ...::read(...) [Ok] | test.rs:12:31:12:56 | TryExpr | provenance | | +| test.rs:12:31:12:56 | TryExpr | test.rs:12:13:12:18 | buffer | provenance | | +| test.rs:17:13:17:18 | buffer | test.rs:18:14:18:19 | buffer | provenance | | +| test.rs:17:31:17:38 | ...::read | test.rs:17:31:17:38 | ...::read [Ok] | provenance | Src:MaD:11 | +| test.rs:17:31:17:38 | ...::read | test.rs:17:31:17:50 | ...::read(...) [Ok] | provenance | Src:MaD:11 | +| test.rs:17:31:17:38 | ...::read [Ok] | test.rs:17:31:17:50 | ...::read(...) [Ok] | provenance | MaD:12 | +| test.rs:17:31:17:50 | ...::read(...) [Ok] | test.rs:17:31:17:51 | TryExpr | provenance | | +| test.rs:17:31:17:51 | TryExpr | test.rs:17:13:17:18 | buffer | provenance | | +| test.rs:22:13:22:18 | buffer | test.rs:23:14:23:19 | buffer | provenance | | +| test.rs:22:22:22:39 | ...::read_to_string | test.rs:22:22:22:39 | ...::read_to_string [Ok] | provenance | Src:MaD:14 | +| test.rs:22:22:22:39 | ...::read_to_string | test.rs:22:22:22:51 | ...::read_to_string(...) [Ok] | provenance | Src:MaD:14 | +| test.rs:22:22:22:39 | ...::read_to_string [Ok] | test.rs:22:22:22:51 | ...::read_to_string(...) [Ok] | provenance | MaD:15 | +| test.rs:22:22:22:51 | ...::read_to_string(...) [Ok] | test.rs:22:22:22:52 | TryExpr | provenance | | +| test.rs:22:22:22:52 | TryExpr | test.rs:22:13:22:18 | buffer | provenance | | +| test.rs:29:13:29:16 | path | test.rs:30:14:30:17 | path | provenance | | +| test.rs:29:13:29:16 | path | test.rs:30:14:30:25 | path.clone() | provenance | MaD:21 | +| test.rs:29:13:29:16 | path | test.rs:31:14:31:17 | path | provenance | | +| test.rs:29:13:29:16 | path | test.rs:31:14:31:25 | path.clone() | provenance | MaD:21 | +| test.rs:29:13:29:16 | path | test.rs:41:14:41:17 | path | provenance | | +| test.rs:29:20:29:27 | e.path() | test.rs:29:13:29:16 | path | provenance | | +| test.rs:29:22:29:25 | path | test.rs:29:20:29:27 | e.path() | provenance | Src:MaD:4 MaD:4 | +| test.rs:30:14:30:17 | path | test.rs:30:14:30:25 | path.clone() | provenance | MaD:21 | +| test.rs:31:14:31:17 | path | test.rs:31:14:31:25 | path.clone() | provenance | MaD:21 | +| test.rs:31:14:31:25 | path.clone() | test.rs:31:14:31:35 | ... .as_path() | provenance | MaD:45 | +| test.rs:43:13:43:21 | file_name | test.rs:44:14:44:22 | file_name | provenance | | +| test.rs:43:13:43:21 | file_name | test.rs:44:14:44:30 | file_name.clone() | provenance | MaD:21 | +| test.rs:43:13:43:21 | file_name | test.rs:49:14:49:22 | file_name | provenance | | +| test.rs:43:25:43:37 | e.file_name() | test.rs:43:13:43:21 | file_name | provenance | | +| test.rs:43:27:43:35 | file_name | test.rs:43:25:43:37 | e.file_name() | provenance | Src:MaD:3 MaD:3 | +| test.rs:44:14:44:22 | file_name | test.rs:44:14:44:30 | file_name.clone() | provenance | MaD:21 | +| test.rs:65:13:65:18 | target | test.rs:66:14:66:19 | target | provenance | | +| test.rs:65:22:65:34 | ...::read_link | test.rs:65:22:65:49 | ...::read_link(...) [Ok] | provenance | Src:MaD:13 | +| test.rs:65:22:65:49 | ...::read_link(...) [Ok] | test.rs:65:22:65:50 | TryExpr | provenance | | +| test.rs:65:22:65:50 | TryExpr | test.rs:65:13:65:18 | target | provenance | | +| test.rs:74:13:74:18 | buffer | test.rs:75:14:75:19 | buffer | provenance | | +| test.rs:74:31:74:45 | ...::read | test.rs:74:31:74:57 | ...::read(...) [future, Ok] | provenance | Src:MaD:16 | +| test.rs:74:31:74:57 | ...::read(...) [future, Ok] | test.rs:74:31:74:63 | await ... [Ok] | provenance | | +| test.rs:74:31:74:63 | await ... [Ok] | test.rs:74:31:74:64 | TryExpr | provenance | | +| test.rs:74:31:74:64 | TryExpr | test.rs:74:13:74:18 | buffer | provenance | | +| test.rs:79:13:79:18 | buffer | test.rs:80:14:80:19 | buffer | provenance | | +| test.rs:79:31:79:45 | ...::read | test.rs:79:31:79:57 | ...::read(...) [future, Ok] | provenance | Src:MaD:16 | +| test.rs:79:31:79:57 | ...::read(...) [future, Ok] | test.rs:79:31:79:63 | await ... [Ok] | provenance | | +| test.rs:79:31:79:63 | await ... [Ok] | test.rs:79:31:79:64 | TryExpr | provenance | | +| test.rs:79:31:79:64 | TryExpr | test.rs:79:13:79:18 | buffer | provenance | | +| test.rs:84:13:84:18 | buffer | test.rs:85:14:85:19 | buffer | provenance | | +| test.rs:84:22:84:46 | ...::read_to_string | test.rs:84:22:84:58 | ...::read_to_string(...) [future, Ok] | provenance | Src:MaD:18 | +| test.rs:84:22:84:58 | ...::read_to_string(...) [future, Ok] | test.rs:84:22:84:64 | await ... [Ok] | provenance | | +| test.rs:84:22:84:64 | await ... [Ok] | test.rs:84:22:84:65 | TryExpr | provenance | | +| test.rs:84:22:84:65 | TryExpr | test.rs:84:13:84:18 | buffer | provenance | | +| test.rs:90:13:90:16 | path | test.rs:92:14:92:17 | path | provenance | | +| test.rs:90:20:90:31 | entry.path() | test.rs:90:13:90:16 | path | provenance | | +| test.rs:90:26:90:29 | path | test.rs:90:20:90:31 | entry.path() | provenance | Src:MaD:10 MaD:10 | +| test.rs:90:26:90:29 | path | test.rs:90:20:90:31 | entry.path() | provenance | Src:MaD:10 MaD:10 | +| test.rs:91:13:91:21 | file_name | test.rs:93:14:93:22 | file_name | provenance | | +| test.rs:91:25:91:41 | entry.file_name() | test.rs:91:13:91:21 | file_name | provenance | | +| test.rs:91:31:91:39 | file_name | test.rs:91:25:91:41 | entry.file_name() | provenance | Src:MaD:9 MaD:9 | +| test.rs:91:31:91:39 | file_name | test.rs:91:25:91:41 | entry.file_name() | provenance | Src:MaD:9 MaD:9 | +| test.rs:97:13:97:18 | target | test.rs:98:14:98:19 | target | provenance | | +| test.rs:97:22:97:41 | ...::read_link | test.rs:97:22:97:56 | ...::read_link(...) [future, Ok] | provenance | Src:MaD:17 | +| test.rs:97:22:97:56 | ...::read_link(...) [future, Ok] | test.rs:97:22:97:62 | await ... [Ok] | provenance | | +| test.rs:97:22:97:62 | await ... [Ok] | test.rs:97:22:97:63 | TryExpr | provenance | | +| test.rs:97:22:97:63 | TryExpr | test.rs:97:13:97:18 | target | provenance | | +| test.rs:107:9:107:16 | mut file | test.rs:111:32:111:42 | [post] &mut buffer | provenance | MaD:42 | +| test.rs:107:9:107:16 | mut file | test.rs:111:32:111:42 | [post] &mut buffer [&ref] | provenance | MaD:27 | +| test.rs:107:9:107:16 | mut file | test.rs:117:39:117:49 | [post] &mut buffer | provenance | MaD:43 | +| test.rs:107:9:107:16 | mut file | test.rs:117:39:117:49 | [post] &mut buffer [&ref] | provenance | MaD:29 | +| test.rs:107:9:107:16 | mut file | test.rs:123:42:123:52 | [post] &mut buffer | provenance | MaD:44 | +| test.rs:107:9:107:16 | mut file | test.rs:123:42:123:52 | [post] &mut buffer [&ref] | provenance | MaD:30 | +| test.rs:107:9:107:16 | mut file | test.rs:129:25:129:35 | [post] &mut buffer [&ref] | provenance | MaD:28 | +| test.rs:107:9:107:16 | mut file | test.rs:133:17:133:28 | file.bytes() | provenance | MaD:24 | +| test.rs:107:20:107:38 | ...::open | test.rs:107:20:107:50 | ...::open(...) [Ok] | provenance | Src:MaD:5 | +| test.rs:107:20:107:50 | ...::open(...) [Ok] | test.rs:107:20:107:51 | TryExpr | provenance | | +| test.rs:107:20:107:51 | TryExpr | test.rs:107:9:107:16 | mut file | provenance | | +| test.rs:111:32:111:42 | [post] &mut buffer | test.rs:112:15:112:20 | buffer | provenance | | +| test.rs:111:32:111:42 | [post] &mut buffer [&ref] | test.rs:111:37:111:42 | [post] buffer | provenance | | +| test.rs:111:37:111:42 | [post] buffer | test.rs:112:15:112:20 | buffer | provenance | | +| test.rs:112:15:112:20 | buffer | test.rs:112:14:112:20 | &buffer | provenance | | +| test.rs:117:39:117:49 | [post] &mut buffer | test.rs:118:15:118:20 | buffer | provenance | | +| test.rs:117:39:117:49 | [post] &mut buffer [&ref] | test.rs:117:44:117:49 | [post] buffer | provenance | | +| test.rs:117:44:117:49 | [post] buffer | test.rs:118:15:118:20 | buffer | provenance | | +| test.rs:118:15:118:20 | buffer | test.rs:118:14:118:20 | &buffer | provenance | | +| test.rs:123:42:123:52 | [post] &mut buffer | test.rs:124:15:124:20 | buffer | provenance | | +| test.rs:123:42:123:52 | [post] &mut buffer [&ref] | test.rs:123:47:123:52 | [post] buffer | provenance | | +| test.rs:123:47:123:52 | [post] buffer | test.rs:124:15:124:20 | buffer | provenance | | +| test.rs:124:15:124:20 | buffer | test.rs:124:14:124:20 | &buffer | provenance | | +| test.rs:129:25:129:35 | [post] &mut buffer [&ref] | test.rs:129:30:129:35 | [post] buffer | provenance | | +| test.rs:129:30:129:35 | [post] buffer | test.rs:130:15:130:20 | buffer | provenance | | +| test.rs:130:15:130:20 | buffer | test.rs:130:14:130:20 | &buffer | provenance | | +| test.rs:133:17:133:28 | file.bytes() | test.rs:134:14:134:17 | byte | provenance | | +| test.rs:140:13:140:18 | mut f1 | test.rs:142:30:142:40 | [post] &mut buffer | provenance | MaD:42 | +| test.rs:140:13:140:18 | mut f1 | test.rs:142:30:142:40 | [post] &mut buffer [&ref] | provenance | MaD:27 | +| test.rs:140:22:140:63 | ... .open(...) [Ok] | test.rs:140:22:140:72 | ... .unwrap() | provenance | MaD:41 | +| test.rs:140:22:140:72 | ... .unwrap() | test.rs:140:13:140:18 | mut f1 | provenance | | +| test.rs:140:50:140:53 | open | test.rs:140:22:140:63 | ... .open(...) [Ok] | provenance | Src:MaD:6 | +| test.rs:142:30:142:40 | [post] &mut buffer | test.rs:143:15:143:20 | buffer | provenance | | +| test.rs:142:30:142:40 | [post] &mut buffer [&ref] | test.rs:142:35:142:40 | [post] buffer | provenance | | +| test.rs:142:35:142:40 | [post] buffer | test.rs:143:15:143:20 | buffer | provenance | | +| test.rs:143:15:143:20 | buffer | test.rs:143:14:143:20 | &buffer | provenance | | +| test.rs:147:13:147:18 | mut f2 | test.rs:149:30:149:40 | [post] &mut buffer | provenance | MaD:42 | +| test.rs:147:13:147:18 | mut f2 | test.rs:149:30:149:40 | [post] &mut buffer [&ref] | provenance | MaD:27 | +| test.rs:147:22:147:80 | ... .open(...) [Ok] | test.rs:147:22:147:89 | ... .unwrap() | provenance | MaD:41 | +| test.rs:147:22:147:89 | ... .unwrap() | test.rs:147:13:147:18 | mut f2 | provenance | | +| test.rs:147:67:147:70 | open | test.rs:147:22:147:80 | ... .open(...) [Ok] | provenance | Src:MaD:6 | +| test.rs:149:30:149:40 | [post] &mut buffer | test.rs:150:15:150:20 | buffer | provenance | | +| test.rs:149:30:149:40 | [post] &mut buffer [&ref] | test.rs:149:35:149:40 | [post] buffer | provenance | | +| test.rs:149:35:149:40 | [post] buffer | test.rs:150:15:150:20 | buffer | provenance | | +| test.rs:150:15:150:20 | buffer | test.rs:150:14:150:20 | &buffer | provenance | | +| test.rs:154:13:154:18 | mut f3 | test.rs:156:30:156:40 | [post] &mut buffer | provenance | MaD:42 | +| test.rs:154:13:154:18 | mut f3 | test.rs:156:30:156:40 | [post] &mut buffer [&ref] | provenance | MaD:27 | +| test.rs:154:22:154:114 | ... .open(...) [Ok] | test.rs:154:22:154:123 | ... .unwrap() | provenance | MaD:41 | +| test.rs:154:22:154:123 | ... .unwrap() | test.rs:154:13:154:18 | mut f3 | provenance | | +| test.rs:154:101:154:104 | open | test.rs:154:22:154:114 | ... .open(...) [Ok] | provenance | Src:MaD:6 | +| test.rs:156:30:156:40 | [post] &mut buffer | test.rs:157:15:157:20 | buffer | provenance | | +| test.rs:156:30:156:40 | [post] &mut buffer [&ref] | test.rs:156:35:156:40 | [post] buffer | provenance | | +| test.rs:156:35:156:40 | [post] buffer | test.rs:157:15:157:20 | buffer | provenance | | +| test.rs:157:15:157:20 | buffer | test.rs:157:14:157:20 | &buffer | provenance | | +| test.rs:164:13:164:17 | file1 | test.rs:166:26:166:43 | file1.chain(...) | provenance | MaD:26 | +| test.rs:164:21:164:39 | ...::open | test.rs:164:21:164:51 | ...::open(...) [Ok] | provenance | Src:MaD:5 | +| test.rs:164:21:164:51 | ...::open(...) [Ok] | test.rs:164:21:164:52 | TryExpr | provenance | | +| test.rs:164:21:164:52 | TryExpr | test.rs:164:13:164:17 | file1 | provenance | | +| test.rs:165:13:165:17 | file2 | test.rs:166:38:166:42 | file2 | provenance | | +| test.rs:165:21:165:39 | ...::open | test.rs:165:21:165:59 | ...::open(...) [Ok] | provenance | Src:MaD:5 | +| test.rs:165:21:165:59 | ...::open(...) [Ok] | test.rs:165:21:165:60 | TryExpr | provenance | | +| test.rs:165:21:165:60 | TryExpr | test.rs:165:13:165:17 | file2 | provenance | | +| test.rs:166:13:166:22 | mut reader | test.rs:167:31:167:41 | [post] &mut buffer [&ref] | provenance | MaD:30 | +| test.rs:166:26:166:43 | file1.chain(...) | test.rs:166:13:166:22 | mut reader | provenance | | +| test.rs:166:38:166:42 | file2 | test.rs:166:26:166:43 | file1.chain(...) | provenance | MaD:25 | +| test.rs:167:31:167:41 | [post] &mut buffer [&ref] | test.rs:167:36:167:41 | [post] buffer | provenance | | +| test.rs:167:36:167:41 | [post] buffer | test.rs:168:15:168:20 | buffer | provenance | | +| test.rs:168:15:168:20 | buffer | test.rs:168:14:168:20 | &buffer | provenance | | +| test.rs:173:13:173:17 | file1 | test.rs:174:26:174:40 | file1.take(...) | provenance | MaD:31 | +| test.rs:173:21:173:39 | ...::open | test.rs:173:21:173:51 | ...::open(...) [Ok] | provenance | Src:MaD:5 | +| test.rs:173:21:173:51 | ...::open(...) [Ok] | test.rs:173:21:173:52 | TryExpr | provenance | | +| test.rs:173:21:173:52 | TryExpr | test.rs:173:13:173:17 | file1 | provenance | | +| test.rs:174:13:174:22 | mut reader | test.rs:175:31:175:41 | [post] &mut buffer [&ref] | provenance | MaD:30 | +| test.rs:174:26:174:40 | file1.take(...) | test.rs:174:13:174:22 | mut reader | provenance | | +| test.rs:175:31:175:41 | [post] &mut buffer [&ref] | test.rs:175:36:175:41 | [post] buffer | provenance | | +| test.rs:175:36:175:41 | [post] buffer | test.rs:176:15:176:20 | buffer | provenance | | +| test.rs:176:15:176:20 | buffer | test.rs:176:14:176:20 | &buffer | provenance | | +| test.rs:185:9:185:16 | mut file | test.rs:189:32:189:42 | [post] &mut buffer [&ref] | provenance | MaD:32 | +| test.rs:185:9:185:16 | mut file | test.rs:195:39:195:49 | [post] &mut buffer [&ref] | provenance | MaD:38 | +| test.rs:185:9:185:16 | mut file | test.rs:201:42:201:52 | [post] &mut buffer [&ref] | provenance | MaD:39 | +| test.rs:185:9:185:16 | mut file | test.rs:207:25:207:35 | [post] &mut buffer [&ref] | provenance | MaD:34 | +| test.rs:185:9:185:16 | mut file | test.rs:212:18:212:31 | file.read_u8() [future, Ok] | provenance | MaD:40 | +| test.rs:185:9:185:16 | mut file | test.rs:213:18:213:32 | file.read_i16() [future, Ok] | provenance | MaD:36 | +| test.rs:185:9:185:16 | mut file | test.rs:214:18:214:32 | file.read_f32() [future, Ok] | provenance | MaD:35 | +| test.rs:185:9:185:16 | mut file | test.rs:215:18:215:35 | file.read_i64_le() [future, Ok] | provenance | MaD:37 | +| test.rs:185:9:185:16 | mut file | test.rs:224:23:224:33 | [post] &mut buffer [&ref] | provenance | MaD:33 | +| test.rs:185:20:185:40 | ...::open | test.rs:185:20:185:52 | ...::open(...) [future, Ok] | provenance | Src:MaD:7 | +| test.rs:185:20:185:52 | ...::open(...) [future, Ok] | test.rs:185:20:185:58 | await ... [Ok] | provenance | | +| test.rs:185:20:185:58 | await ... [Ok] | test.rs:185:20:185:59 | TryExpr | provenance | | +| test.rs:185:20:185:59 | TryExpr | test.rs:185:9:185:16 | mut file | provenance | | +| test.rs:189:32:189:42 | [post] &mut buffer [&ref] | test.rs:189:37:189:42 | [post] buffer | provenance | | +| test.rs:189:37:189:42 | [post] buffer | test.rs:190:15:190:20 | buffer | provenance | | +| test.rs:190:15:190:20 | buffer | test.rs:190:14:190:20 | &buffer | provenance | | +| test.rs:195:39:195:49 | [post] &mut buffer [&ref] | test.rs:195:44:195:49 | [post] buffer | provenance | | +| test.rs:195:44:195:49 | [post] buffer | test.rs:196:15:196:20 | buffer | provenance | | +| test.rs:196:15:196:20 | buffer | test.rs:196:14:196:20 | &buffer | provenance | | +| test.rs:201:42:201:52 | [post] &mut buffer [&ref] | test.rs:201:47:201:52 | [post] buffer | provenance | | +| test.rs:201:47:201:52 | [post] buffer | test.rs:202:15:202:20 | buffer | provenance | | +| test.rs:202:15:202:20 | buffer | test.rs:202:14:202:20 | &buffer | provenance | | +| test.rs:207:25:207:35 | [post] &mut buffer [&ref] | test.rs:207:30:207:35 | [post] buffer | provenance | | +| test.rs:207:30:207:35 | [post] buffer | test.rs:208:15:208:20 | buffer | provenance | | +| test.rs:208:15:208:20 | buffer | test.rs:208:14:208:20 | &buffer | provenance | | +| test.rs:212:13:212:14 | v1 | test.rs:216:14:216:15 | v1 | provenance | | +| test.rs:212:18:212:31 | file.read_u8() [future, Ok] | test.rs:212:18:212:37 | await ... [Ok] | provenance | | +| test.rs:212:18:212:37 | await ... [Ok] | test.rs:212:18:212:38 | TryExpr | provenance | | +| test.rs:212:18:212:38 | TryExpr | test.rs:212:13:212:14 | v1 | provenance | | +| test.rs:213:13:213:14 | v2 | test.rs:217:14:217:15 | v2 | provenance | | +| test.rs:213:18:213:32 | file.read_i16() [future, Ok] | test.rs:213:18:213:38 | await ... [Ok] | provenance | | +| test.rs:213:18:213:38 | await ... [Ok] | test.rs:213:18:213:39 | TryExpr | provenance | | +| test.rs:213:18:213:39 | TryExpr | test.rs:213:13:213:14 | v2 | provenance | | +| test.rs:214:13:214:14 | v3 | test.rs:218:14:218:15 | v3 | provenance | | +| test.rs:214:18:214:32 | file.read_f32() [future, Ok] | test.rs:214:18:214:38 | await ... [Ok] | provenance | | +| test.rs:214:18:214:38 | await ... [Ok] | test.rs:214:18:214:39 | TryExpr | provenance | | +| test.rs:214:18:214:39 | TryExpr | test.rs:214:13:214:14 | v3 | provenance | | +| test.rs:215:13:215:14 | v4 | test.rs:219:14:219:15 | v4 | provenance | | +| test.rs:215:18:215:35 | file.read_i64_le() [future, Ok] | test.rs:215:18:215:41 | await ... [Ok] | provenance | | +| test.rs:215:18:215:41 | await ... [Ok] | test.rs:215:18:215:42 | TryExpr | provenance | | +| test.rs:215:18:215:42 | TryExpr | test.rs:215:13:215:14 | v4 | provenance | | +| test.rs:224:23:224:33 | [post] &mut buffer [&ref] | test.rs:224:28:224:33 | [post] buffer | provenance | | +| test.rs:224:28:224:33 | [post] buffer | test.rs:225:15:225:20 | buffer | provenance | | +| test.rs:225:15:225:20 | buffer | test.rs:225:14:225:20 | &buffer | provenance | | +| test.rs:231:13:231:18 | mut f1 | test.rs:233:30:233:40 | [post] &mut buffer [&ref] | provenance | MaD:32 | +| test.rs:231:22:231:65 | ... .open(...) [future, Ok] | test.rs:231:22:231:71 | await ... [Ok] | provenance | | +| test.rs:231:22:231:71 | await ... [Ok] | test.rs:231:22:231:72 | TryExpr | provenance | | +| test.rs:231:22:231:72 | TryExpr | test.rs:231:13:231:18 | mut f1 | provenance | | +| test.rs:231:52:231:55 | open | test.rs:231:22:231:65 | ... .open(...) [future, Ok] | provenance | Src:MaD:8 | +| test.rs:233:30:233:40 | [post] &mut buffer [&ref] | test.rs:233:35:233:40 | [post] buffer | provenance | | +| test.rs:233:35:233:40 | [post] buffer | test.rs:234:15:234:20 | buffer | provenance | | +| test.rs:234:15:234:20 | buffer | test.rs:234:14:234:20 | &buffer | provenance | | +| test.rs:262:9:262:16 | mut file | test.rs:266:22:266:25 | file | provenance | | +| test.rs:262:9:262:16 | mut file | test.rs:266:32:266:42 | [post] &mut buffer [&ref] | provenance | MaD:19 | +| test.rs:262:9:262:16 | mut file | test.rs:266:32:266:42 | [post] &mut buffer [&ref] | provenance | MaD:20 | +| test.rs:262:9:262:16 | mut file | test.rs:266:32:266:42 | [post] &mut buffer [&ref] | provenance | MaD:22 | +| test.rs:262:9:262:16 | mut file | test.rs:266:32:266:42 | [post] &mut buffer [&ref] | provenance | MaD:23 | +| test.rs:262:20:262:44 | ...::open | test.rs:262:20:262:56 | ...::open(...) [future, Ok] | provenance | Src:MaD:1 | +| test.rs:262:20:262:56 | ...::open(...) [future, Ok] | test.rs:262:20:262:62 | await ... [Ok] | provenance | | +| test.rs:262:20:262:62 | await ... [Ok] | test.rs:262:20:262:63 | TryExpr | provenance | | +| test.rs:262:20:262:63 | TryExpr | test.rs:262:9:262:16 | mut file | provenance | | +| test.rs:266:22:266:25 | file | test.rs:266:32:266:42 | [post] &mut buffer [&ref] | provenance | MaD:19 | +| test.rs:266:22:266:25 | file | test.rs:266:32:266:42 | [post] &mut buffer [&ref] | provenance | MaD:22 | +| test.rs:266:32:266:42 | [post] &mut buffer [&ref] | test.rs:266:37:266:42 | [post] buffer | provenance | | +| test.rs:266:37:266:42 | [post] buffer | test.rs:267:15:267:20 | buffer | provenance | | +| test.rs:267:15:267:20 | buffer | test.rs:267:14:267:20 | &buffer | provenance | | +| test.rs:273:13:273:18 | mut f1 | test.rs:275:22:275:23 | f1 | provenance | | +| test.rs:273:13:273:18 | mut f1 | test.rs:275:30:275:40 | [post] &mut buffer [&ref] | provenance | MaD:19 | +| test.rs:273:13:273:18 | mut f1 | test.rs:275:30:275:40 | [post] &mut buffer [&ref] | provenance | MaD:20 | +| test.rs:273:13:273:18 | mut f1 | test.rs:275:30:275:40 | [post] &mut buffer [&ref] | provenance | MaD:22 | +| test.rs:273:13:273:18 | mut f1 | test.rs:275:30:275:40 | [post] &mut buffer [&ref] | provenance | MaD:23 | +| test.rs:273:22:273:69 | ... .open(...) [future, Ok] | test.rs:273:22:273:75 | await ... [Ok] | provenance | | +| test.rs:273:22:273:75 | await ... [Ok] | test.rs:273:22:273:76 | TryExpr | provenance | | +| test.rs:273:22:273:76 | TryExpr | test.rs:273:13:273:18 | mut f1 | provenance | | +| test.rs:273:56:273:59 | open | test.rs:273:22:273:69 | ... .open(...) [future, Ok] | provenance | Src:MaD:2 | +| test.rs:275:22:275:23 | f1 | test.rs:275:30:275:40 | [post] &mut buffer [&ref] | provenance | MaD:19 | +| test.rs:275:22:275:23 | f1 | test.rs:275:30:275:40 | [post] &mut buffer [&ref] | provenance | MaD:22 | +| test.rs:275:30:275:40 | [post] &mut buffer [&ref] | test.rs:275:35:275:40 | [post] buffer | provenance | | +| test.rs:275:35:275:40 | [post] buffer | test.rs:276:15:276:20 | buffer | provenance | | +| test.rs:276:15:276:20 | buffer | test.rs:276:14:276:20 | &buffer | provenance | | +nodes +| test.rs:12:13:12:18 | buffer | semmle.label | buffer | +| test.rs:12:31:12:43 | ...::read | semmle.label | ...::read | +| test.rs:12:31:12:43 | ...::read [Ok] | semmle.label | ...::read [Ok] | +| test.rs:12:31:12:55 | ...::read(...) [Ok] | semmle.label | ...::read(...) [Ok] | +| test.rs:12:31:12:56 | TryExpr | semmle.label | TryExpr | +| test.rs:13:14:13:19 | buffer | semmle.label | buffer | +| test.rs:17:13:17:18 | buffer | semmle.label | buffer | +| test.rs:17:31:17:38 | ...::read | semmle.label | ...::read | +| test.rs:17:31:17:38 | ...::read [Ok] | semmle.label | ...::read [Ok] | +| test.rs:17:31:17:50 | ...::read(...) [Ok] | semmle.label | ...::read(...) [Ok] | +| test.rs:17:31:17:51 | TryExpr | semmle.label | TryExpr | +| test.rs:18:14:18:19 | buffer | semmle.label | buffer | +| test.rs:22:13:22:18 | buffer | semmle.label | buffer | +| test.rs:22:22:22:39 | ...::read_to_string | semmle.label | ...::read_to_string | +| test.rs:22:22:22:39 | ...::read_to_string [Ok] | semmle.label | ...::read_to_string [Ok] | +| test.rs:22:22:22:51 | ...::read_to_string(...) [Ok] | semmle.label | ...::read_to_string(...) [Ok] | +| test.rs:22:22:22:52 | TryExpr | semmle.label | TryExpr | +| test.rs:23:14:23:19 | buffer | semmle.label | buffer | +| test.rs:29:13:29:16 | path | semmle.label | path | +| test.rs:29:20:29:27 | e.path() | semmle.label | e.path() | +| test.rs:29:22:29:25 | path | semmle.label | path | +| test.rs:30:14:30:17 | path | semmle.label | path | +| test.rs:30:14:30:25 | path.clone() | semmle.label | path.clone() | +| test.rs:31:14:31:17 | path | semmle.label | path | +| test.rs:31:14:31:25 | path.clone() | semmle.label | path.clone() | +| test.rs:31:14:31:35 | ... .as_path() | semmle.label | ... .as_path() | +| test.rs:41:14:41:17 | path | semmle.label | path | +| test.rs:43:13:43:21 | file_name | semmle.label | file_name | +| test.rs:43:25:43:37 | e.file_name() | semmle.label | e.file_name() | +| test.rs:43:27:43:35 | file_name | semmle.label | file_name | +| test.rs:44:14:44:22 | file_name | semmle.label | file_name | +| test.rs:44:14:44:30 | file_name.clone() | semmle.label | file_name.clone() | +| test.rs:49:14:49:22 | file_name | semmle.label | file_name | +| test.rs:65:13:65:18 | target | semmle.label | target | +| test.rs:65:22:65:34 | ...::read_link | semmle.label | ...::read_link | +| test.rs:65:22:65:49 | ...::read_link(...) [Ok] | semmle.label | ...::read_link(...) [Ok] | +| test.rs:65:22:65:50 | TryExpr | semmle.label | TryExpr | +| test.rs:66:14:66:19 | target | semmle.label | target | +| test.rs:74:13:74:18 | buffer | semmle.label | buffer | +| test.rs:74:31:74:45 | ...::read | semmle.label | ...::read | +| test.rs:74:31:74:57 | ...::read(...) [future, Ok] | semmle.label | ...::read(...) [future, Ok] | +| test.rs:74:31:74:63 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:74:31:74:64 | TryExpr | semmle.label | TryExpr | +| test.rs:75:14:75:19 | buffer | semmle.label | buffer | +| test.rs:79:13:79:18 | buffer | semmle.label | buffer | +| test.rs:79:31:79:45 | ...::read | semmle.label | ...::read | +| test.rs:79:31:79:57 | ...::read(...) [future, Ok] | semmle.label | ...::read(...) [future, Ok] | +| test.rs:79:31:79:63 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:79:31:79:64 | TryExpr | semmle.label | TryExpr | +| test.rs:80:14:80:19 | buffer | semmle.label | buffer | +| test.rs:84:13:84:18 | buffer | semmle.label | buffer | +| test.rs:84:22:84:46 | ...::read_to_string | semmle.label | ...::read_to_string | +| test.rs:84:22:84:58 | ...::read_to_string(...) [future, Ok] | semmle.label | ...::read_to_string(...) [future, Ok] | +| test.rs:84:22:84:64 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:84:22:84:65 | TryExpr | semmle.label | TryExpr | +| test.rs:85:14:85:19 | buffer | semmle.label | buffer | +| test.rs:90:13:90:16 | path | semmle.label | path | +| test.rs:90:20:90:31 | entry.path() | semmle.label | entry.path() | +| test.rs:90:26:90:29 | path | semmle.label | path | +| test.rs:90:26:90:29 | path | semmle.label | path | +| test.rs:91:13:91:21 | file_name | semmle.label | file_name | +| test.rs:91:25:91:41 | entry.file_name() | semmle.label | entry.file_name() | +| test.rs:91:31:91:39 | file_name | semmle.label | file_name | +| test.rs:91:31:91:39 | file_name | semmle.label | file_name | +| test.rs:92:14:92:17 | path | semmle.label | path | +| test.rs:93:14:93:22 | file_name | semmle.label | file_name | +| test.rs:97:13:97:18 | target | semmle.label | target | +| test.rs:97:22:97:41 | ...::read_link | semmle.label | ...::read_link | +| test.rs:97:22:97:56 | ...::read_link(...) [future, Ok] | semmle.label | ...::read_link(...) [future, Ok] | +| test.rs:97:22:97:62 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:97:22:97:63 | TryExpr | semmle.label | TryExpr | +| test.rs:98:14:98:19 | target | semmle.label | target | +| test.rs:107:9:107:16 | mut file | semmle.label | mut file | +| test.rs:107:20:107:38 | ...::open | semmle.label | ...::open | +| test.rs:107:20:107:50 | ...::open(...) [Ok] | semmle.label | ...::open(...) [Ok] | +| test.rs:107:20:107:51 | TryExpr | semmle.label | TryExpr | +| test.rs:111:32:111:42 | [post] &mut buffer | semmle.label | [post] &mut buffer | +| test.rs:111:32:111:42 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:111:37:111:42 | [post] buffer | semmle.label | [post] buffer | +| test.rs:112:14:112:20 | &buffer | semmle.label | &buffer | +| test.rs:112:15:112:20 | buffer | semmle.label | buffer | +| test.rs:117:39:117:49 | [post] &mut buffer | semmle.label | [post] &mut buffer | +| test.rs:117:39:117:49 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:117:44:117:49 | [post] buffer | semmle.label | [post] buffer | +| test.rs:118:14:118:20 | &buffer | semmle.label | &buffer | +| test.rs:118:15:118:20 | buffer | semmle.label | buffer | +| test.rs:123:42:123:52 | [post] &mut buffer | semmle.label | [post] &mut buffer | +| test.rs:123:42:123:52 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:123:47:123:52 | [post] buffer | semmle.label | [post] buffer | +| test.rs:124:14:124:20 | &buffer | semmle.label | &buffer | +| test.rs:124:15:124:20 | buffer | semmle.label | buffer | +| test.rs:129:25:129:35 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:129:30:129:35 | [post] buffer | semmle.label | [post] buffer | +| test.rs:130:14:130:20 | &buffer | semmle.label | &buffer | +| test.rs:130:15:130:20 | buffer | semmle.label | buffer | +| test.rs:133:17:133:28 | file.bytes() | semmle.label | file.bytes() | +| test.rs:134:14:134:17 | byte | semmle.label | byte | +| test.rs:140:13:140:18 | mut f1 | semmle.label | mut f1 | +| test.rs:140:22:140:63 | ... .open(...) [Ok] | semmle.label | ... .open(...) [Ok] | +| test.rs:140:22:140:72 | ... .unwrap() | semmle.label | ... .unwrap() | +| test.rs:140:50:140:53 | open | semmle.label | open | +| test.rs:142:30:142:40 | [post] &mut buffer | semmle.label | [post] &mut buffer | +| test.rs:142:30:142:40 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:142:35:142:40 | [post] buffer | semmle.label | [post] buffer | +| test.rs:143:14:143:20 | &buffer | semmle.label | &buffer | +| test.rs:143:15:143:20 | buffer | semmle.label | buffer | +| test.rs:147:13:147:18 | mut f2 | semmle.label | mut f2 | +| test.rs:147:22:147:80 | ... .open(...) [Ok] | semmle.label | ... .open(...) [Ok] | +| test.rs:147:22:147:89 | ... .unwrap() | semmle.label | ... .unwrap() | +| test.rs:147:67:147:70 | open | semmle.label | open | +| test.rs:149:30:149:40 | [post] &mut buffer | semmle.label | [post] &mut buffer | +| test.rs:149:30:149:40 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:149:35:149:40 | [post] buffer | semmle.label | [post] buffer | +| test.rs:150:14:150:20 | &buffer | semmle.label | &buffer | +| test.rs:150:15:150:20 | buffer | semmle.label | buffer | +| test.rs:154:13:154:18 | mut f3 | semmle.label | mut f3 | +| test.rs:154:22:154:114 | ... .open(...) [Ok] | semmle.label | ... .open(...) [Ok] | +| test.rs:154:22:154:123 | ... .unwrap() | semmle.label | ... .unwrap() | +| test.rs:154:101:154:104 | open | semmle.label | open | +| test.rs:156:30:156:40 | [post] &mut buffer | semmle.label | [post] &mut buffer | +| test.rs:156:30:156:40 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:156:35:156:40 | [post] buffer | semmle.label | [post] buffer | +| test.rs:157:14:157:20 | &buffer | semmle.label | &buffer | +| test.rs:157:15:157:20 | buffer | semmle.label | buffer | +| test.rs:164:13:164:17 | file1 | semmle.label | file1 | +| test.rs:164:21:164:39 | ...::open | semmle.label | ...::open | +| test.rs:164:21:164:51 | ...::open(...) [Ok] | semmle.label | ...::open(...) [Ok] | +| test.rs:164:21:164:52 | TryExpr | semmle.label | TryExpr | +| test.rs:165:13:165:17 | file2 | semmle.label | file2 | +| test.rs:165:21:165:39 | ...::open | semmle.label | ...::open | +| test.rs:165:21:165:59 | ...::open(...) [Ok] | semmle.label | ...::open(...) [Ok] | +| test.rs:165:21:165:60 | TryExpr | semmle.label | TryExpr | +| test.rs:166:13:166:22 | mut reader | semmle.label | mut reader | +| test.rs:166:26:166:43 | file1.chain(...) | semmle.label | file1.chain(...) | +| test.rs:166:38:166:42 | file2 | semmle.label | file2 | +| test.rs:167:31:167:41 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:167:36:167:41 | [post] buffer | semmle.label | [post] buffer | +| test.rs:168:14:168:20 | &buffer | semmle.label | &buffer | +| test.rs:168:15:168:20 | buffer | semmle.label | buffer | +| test.rs:173:13:173:17 | file1 | semmle.label | file1 | +| test.rs:173:21:173:39 | ...::open | semmle.label | ...::open | +| test.rs:173:21:173:51 | ...::open(...) [Ok] | semmle.label | ...::open(...) [Ok] | +| test.rs:173:21:173:52 | TryExpr | semmle.label | TryExpr | +| test.rs:174:13:174:22 | mut reader | semmle.label | mut reader | +| test.rs:174:26:174:40 | file1.take(...) | semmle.label | file1.take(...) | +| test.rs:175:31:175:41 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:175:36:175:41 | [post] buffer | semmle.label | [post] buffer | +| test.rs:176:14:176:20 | &buffer | semmle.label | &buffer | +| test.rs:176:15:176:20 | buffer | semmle.label | buffer | +| test.rs:185:9:185:16 | mut file | semmle.label | mut file | +| test.rs:185:20:185:40 | ...::open | semmle.label | ...::open | +| test.rs:185:20:185:52 | ...::open(...) [future, Ok] | semmle.label | ...::open(...) [future, Ok] | +| test.rs:185:20:185:58 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:185:20:185:59 | TryExpr | semmle.label | TryExpr | +| test.rs:189:32:189:42 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:189:37:189:42 | [post] buffer | semmle.label | [post] buffer | +| test.rs:190:14:190:20 | &buffer | semmle.label | &buffer | +| test.rs:190:15:190:20 | buffer | semmle.label | buffer | +| test.rs:195:39:195:49 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:195:44:195:49 | [post] buffer | semmle.label | [post] buffer | +| test.rs:196:14:196:20 | &buffer | semmle.label | &buffer | +| test.rs:196:15:196:20 | buffer | semmle.label | buffer | +| test.rs:201:42:201:52 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:201:47:201:52 | [post] buffer | semmle.label | [post] buffer | +| test.rs:202:14:202:20 | &buffer | semmle.label | &buffer | +| test.rs:202:15:202:20 | buffer | semmle.label | buffer | +| test.rs:207:25:207:35 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:207:30:207:35 | [post] buffer | semmle.label | [post] buffer | +| test.rs:208:14:208:20 | &buffer | semmle.label | &buffer | +| test.rs:208:15:208:20 | buffer | semmle.label | buffer | +| test.rs:212:13:212:14 | v1 | semmle.label | v1 | +| test.rs:212:18:212:31 | file.read_u8() [future, Ok] | semmle.label | file.read_u8() [future, Ok] | +| test.rs:212:18:212:37 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:212:18:212:38 | TryExpr | semmle.label | TryExpr | +| test.rs:213:13:213:14 | v2 | semmle.label | v2 | +| test.rs:213:18:213:32 | file.read_i16() [future, Ok] | semmle.label | file.read_i16() [future, Ok] | +| test.rs:213:18:213:38 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:213:18:213:39 | TryExpr | semmle.label | TryExpr | +| test.rs:214:13:214:14 | v3 | semmle.label | v3 | +| test.rs:214:18:214:32 | file.read_f32() [future, Ok] | semmle.label | file.read_f32() [future, Ok] | +| test.rs:214:18:214:38 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:214:18:214:39 | TryExpr | semmle.label | TryExpr | +| test.rs:215:13:215:14 | v4 | semmle.label | v4 | +| test.rs:215:18:215:35 | file.read_i64_le() [future, Ok] | semmle.label | file.read_i64_le() [future, Ok] | +| test.rs:215:18:215:41 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:215:18:215:42 | TryExpr | semmle.label | TryExpr | +| test.rs:216:14:216:15 | v1 | semmle.label | v1 | +| test.rs:217:14:217:15 | v2 | semmle.label | v2 | +| test.rs:218:14:218:15 | v3 | semmle.label | v3 | +| test.rs:219:14:219:15 | v4 | semmle.label | v4 | +| test.rs:224:23:224:33 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:224:28:224:33 | [post] buffer | semmle.label | [post] buffer | +| test.rs:225:14:225:20 | &buffer | semmle.label | &buffer | +| test.rs:225:15:225:20 | buffer | semmle.label | buffer | +| test.rs:231:13:231:18 | mut f1 | semmle.label | mut f1 | +| test.rs:231:22:231:65 | ... .open(...) [future, Ok] | semmle.label | ... .open(...) [future, Ok] | +| test.rs:231:22:231:71 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:231:22:231:72 | TryExpr | semmle.label | TryExpr | +| test.rs:231:52:231:55 | open | semmle.label | open | +| test.rs:233:30:233:40 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:233:35:233:40 | [post] buffer | semmle.label | [post] buffer | +| test.rs:234:14:234:20 | &buffer | semmle.label | &buffer | +| test.rs:234:15:234:20 | buffer | semmle.label | buffer | +| test.rs:262:9:262:16 | mut file | semmle.label | mut file | +| test.rs:262:20:262:44 | ...::open | semmle.label | ...::open | +| test.rs:262:20:262:56 | ...::open(...) [future, Ok] | semmle.label | ...::open(...) [future, Ok] | +| test.rs:262:20:262:62 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:262:20:262:63 | TryExpr | semmle.label | TryExpr | +| test.rs:266:22:266:25 | file | semmle.label | file | +| test.rs:266:32:266:42 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:266:37:266:42 | [post] buffer | semmle.label | [post] buffer | +| test.rs:267:14:267:20 | &buffer | semmle.label | &buffer | +| test.rs:267:15:267:20 | buffer | semmle.label | buffer | +| test.rs:273:13:273:18 | mut f1 | semmle.label | mut f1 | +| test.rs:273:22:273:69 | ... .open(...) [future, Ok] | semmle.label | ... .open(...) [future, Ok] | +| test.rs:273:22:273:75 | await ... [Ok] | semmle.label | await ... [Ok] | +| test.rs:273:22:273:76 | TryExpr | semmle.label | TryExpr | +| test.rs:273:56:273:59 | open | semmle.label | open | +| test.rs:275:22:275:23 | f1 | semmle.label | f1 | +| test.rs:275:30:275:40 | [post] &mut buffer [&ref] | semmle.label | [post] &mut buffer [&ref] | +| test.rs:275:35:275:40 | [post] buffer | semmle.label | [post] buffer | +| test.rs:276:14:276:20 | &buffer | semmle.label | &buffer | +| test.rs:276:15:276:20 | buffer | semmle.label | buffer | +subpaths +testFailures +#select +| test.rs:13:14:13:19 | buffer | test.rs:12:31:12:43 | ...::read | test.rs:13:14:13:19 | buffer | $@ | test.rs:12:31:12:43 | ...::read | ...::read | +| test.rs:18:14:18:19 | buffer | test.rs:17:31:17:38 | ...::read | test.rs:18:14:18:19 | buffer | $@ | test.rs:17:31:17:38 | ...::read | ...::read | +| test.rs:23:14:23:19 | buffer | test.rs:22:22:22:39 | ...::read_to_string | test.rs:23:14:23:19 | buffer | $@ | test.rs:22:22:22:39 | ...::read_to_string | ...::read_to_string | +| test.rs:30:14:30:25 | path.clone() | test.rs:29:22:29:25 | path | test.rs:30:14:30:25 | path.clone() | $@ | test.rs:29:22:29:25 | path | path | +| test.rs:31:14:31:35 | ... .as_path() | test.rs:29:22:29:25 | path | test.rs:31:14:31:35 | ... .as_path() | $@ | test.rs:29:22:29:25 | path | path | +| test.rs:41:14:41:17 | path | test.rs:29:22:29:25 | path | test.rs:41:14:41:17 | path | $@ | test.rs:29:22:29:25 | path | path | +| test.rs:44:14:44:30 | file_name.clone() | test.rs:43:27:43:35 | file_name | test.rs:44:14:44:30 | file_name.clone() | $@ | test.rs:43:27:43:35 | file_name | file_name | +| test.rs:49:14:49:22 | file_name | test.rs:43:27:43:35 | file_name | test.rs:49:14:49:22 | file_name | $@ | test.rs:43:27:43:35 | file_name | file_name | +| test.rs:66:14:66:19 | target | test.rs:65:22:65:34 | ...::read_link | test.rs:66:14:66:19 | target | $@ | test.rs:65:22:65:34 | ...::read_link | ...::read_link | +| test.rs:75:14:75:19 | buffer | test.rs:74:31:74:45 | ...::read | test.rs:75:14:75:19 | buffer | $@ | test.rs:74:31:74:45 | ...::read | ...::read | +| test.rs:80:14:80:19 | buffer | test.rs:79:31:79:45 | ...::read | test.rs:80:14:80:19 | buffer | $@ | test.rs:79:31:79:45 | ...::read | ...::read | +| test.rs:85:14:85:19 | buffer | test.rs:84:22:84:46 | ...::read_to_string | test.rs:85:14:85:19 | buffer | $@ | test.rs:84:22:84:46 | ...::read_to_string | ...::read_to_string | +| test.rs:92:14:92:17 | path | test.rs:90:26:90:29 | path | test.rs:92:14:92:17 | path | $@ | test.rs:90:26:90:29 | path | path | +| test.rs:92:14:92:17 | path | test.rs:90:26:90:29 | path | test.rs:92:14:92:17 | path | $@ | test.rs:90:26:90:29 | path | path | +| test.rs:93:14:93:22 | file_name | test.rs:91:31:91:39 | file_name | test.rs:93:14:93:22 | file_name | $@ | test.rs:91:31:91:39 | file_name | file_name | +| test.rs:93:14:93:22 | file_name | test.rs:91:31:91:39 | file_name | test.rs:93:14:93:22 | file_name | $@ | test.rs:91:31:91:39 | file_name | file_name | +| test.rs:98:14:98:19 | target | test.rs:97:22:97:41 | ...::read_link | test.rs:98:14:98:19 | target | $@ | test.rs:97:22:97:41 | ...::read_link | ...::read_link | +| test.rs:112:14:112:20 | &buffer | test.rs:107:20:107:38 | ...::open | test.rs:112:14:112:20 | &buffer | $@ | test.rs:107:20:107:38 | ...::open | ...::open | +| test.rs:118:14:118:20 | &buffer | test.rs:107:20:107:38 | ...::open | test.rs:118:14:118:20 | &buffer | $@ | test.rs:107:20:107:38 | ...::open | ...::open | +| test.rs:124:14:124:20 | &buffer | test.rs:107:20:107:38 | ...::open | test.rs:124:14:124:20 | &buffer | $@ | test.rs:107:20:107:38 | ...::open | ...::open | +| test.rs:130:14:130:20 | &buffer | test.rs:107:20:107:38 | ...::open | test.rs:130:14:130:20 | &buffer | $@ | test.rs:107:20:107:38 | ...::open | ...::open | +| test.rs:134:14:134:17 | byte | test.rs:107:20:107:38 | ...::open | test.rs:134:14:134:17 | byte | $@ | test.rs:107:20:107:38 | ...::open | ...::open | +| test.rs:143:14:143:20 | &buffer | test.rs:140:50:140:53 | open | test.rs:143:14:143:20 | &buffer | $@ | test.rs:140:50:140:53 | open | open | +| test.rs:150:14:150:20 | &buffer | test.rs:147:67:147:70 | open | test.rs:150:14:150:20 | &buffer | $@ | test.rs:147:67:147:70 | open | open | +| test.rs:157:14:157:20 | &buffer | test.rs:154:101:154:104 | open | test.rs:157:14:157:20 | &buffer | $@ | test.rs:154:101:154:104 | open | open | +| test.rs:168:14:168:20 | &buffer | test.rs:164:21:164:39 | ...::open | test.rs:168:14:168:20 | &buffer | $@ | test.rs:164:21:164:39 | ...::open | ...::open | +| test.rs:168:14:168:20 | &buffer | test.rs:165:21:165:39 | ...::open | test.rs:168:14:168:20 | &buffer | $@ | test.rs:165:21:165:39 | ...::open | ...::open | +| test.rs:176:14:176:20 | &buffer | test.rs:173:21:173:39 | ...::open | test.rs:176:14:176:20 | &buffer | $@ | test.rs:173:21:173:39 | ...::open | ...::open | +| test.rs:190:14:190:20 | &buffer | test.rs:185:20:185:40 | ...::open | test.rs:190:14:190:20 | &buffer | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:196:14:196:20 | &buffer | test.rs:185:20:185:40 | ...::open | test.rs:196:14:196:20 | &buffer | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:202:14:202:20 | &buffer | test.rs:185:20:185:40 | ...::open | test.rs:202:14:202:20 | &buffer | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:208:14:208:20 | &buffer | test.rs:185:20:185:40 | ...::open | test.rs:208:14:208:20 | &buffer | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:216:14:216:15 | v1 | test.rs:185:20:185:40 | ...::open | test.rs:216:14:216:15 | v1 | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:217:14:217:15 | v2 | test.rs:185:20:185:40 | ...::open | test.rs:217:14:217:15 | v2 | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:218:14:218:15 | v3 | test.rs:185:20:185:40 | ...::open | test.rs:218:14:218:15 | v3 | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:219:14:219:15 | v4 | test.rs:185:20:185:40 | ...::open | test.rs:219:14:219:15 | v4 | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:225:14:225:20 | &buffer | test.rs:185:20:185:40 | ...::open | test.rs:225:14:225:20 | &buffer | $@ | test.rs:185:20:185:40 | ...::open | ...::open | +| test.rs:234:14:234:20 | &buffer | test.rs:231:52:231:55 | open | test.rs:234:14:234:20 | &buffer | $@ | test.rs:231:52:231:55 | open | open | +| test.rs:267:14:267:20 | &buffer | test.rs:262:20:262:44 | ...::open | test.rs:267:14:267:20 | &buffer | $@ | test.rs:262:20:262:44 | ...::open | ...::open | +| test.rs:276:14:276:20 | &buffer | test.rs:273:56:273:59 | open | test.rs:276:14:276:20 | &buffer | $@ | test.rs:273:56:273:59 | open | open | diff --git a/rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.ql b/rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.ql new file mode 100644 index 00000000000..09b4ab5bf90 --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/InlineFlow.ql @@ -0,0 +1,36 @@ +/** + * @kind path-problem + */ + +import rust +import codeql.rust.dataflow.DataFlow +import codeql.rust.Concepts +import utils.test.InlineFlowTest + +/** + * Configuration for flow from any threat model source to an argument of the function `sink`. + */ +module MyFlowConfig implements DataFlow::ConfigSig { + predicate isSource(DataFlow::Node source) { source instanceof ThreatModelSource } + + predicate isSink(DataFlow::Node sink) { + any(CallExpr call | + call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink" + ).getArgList().getAnArg() = sink.asExpr().getExpr() + } + + predicate allowImplicitRead(DataFlow::Node node, DataFlow::ContentSet c) { + // flow out from any content at the sink. + isSink(node) and + exists(c) + } +} + +module MyFlowTest = TaintFlowTest; + +import MyFlowTest +import PathGraph + +from PathNode source, PathNode sink +where flowPath(source, sink) +select sink, source, sink, "$@", source, source.toString() diff --git a/rust/ql/test/library-tests/dataflow/sources/file/TaintSources.expected b/rust/ql/test/library-tests/dataflow/sources/file/TaintSources.expected new file mode 100644 index 00000000000..d73106fb1cf --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/TaintSources.expected @@ -0,0 +1,33 @@ +| test.rs:12:31:12:43 | ...::read | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:12:31:12:43 | ...::read | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:17:31:17:38 | ...::read | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:17:31:17:38 | ...::read | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:22:22:22:39 | ...::read_to_string | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:22:22:22:39 | ...::read_to_string | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:29:22:29:25 | path | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:43:27:43:35 | file_name | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:54:22:54:25 | path | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:55:27:55:35 | file_name | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:65:22:65:34 | ...::read_link | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:74:31:74:45 | ...::read | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:79:31:79:45 | ...::read | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:84:22:84:46 | ...::read_to_string | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:90:26:90:29 | path | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:90:26:90:29 | path | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:91:31:91:39 | file_name | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:91:31:91:39 | file_name | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:97:22:97:41 | ...::read_link | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:107:20:107:38 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:140:50:140:53 | open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:147:67:147:70 | open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:154:101:154:104 | open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:164:21:164:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:165:21:165:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:173:21:173:39 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:185:20:185:40 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:231:52:231:55 | open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:241:21:241:41 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:242:21:242:41 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:250:21:250:41 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:262:20:262:44 | ...::open | Flow source 'FileSource' of type file (DEFAULT). | +| test.rs:273:56:273:59 | open | Flow source 'FileSource' of type file (DEFAULT). | diff --git a/rust/ql/test/library-tests/dataflow/sources/file/TaintSources.qlref b/rust/ql/test/library-tests/dataflow/sources/file/TaintSources.qlref new file mode 100644 index 00000000000..7aa95121af3 --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/TaintSources.qlref @@ -0,0 +1,2 @@ +query: queries/summary/TaintSources.ql +postprocess: utils/test/InlineExpectationsTestQuery.ql diff --git a/rust/ql/test/library-tests/dataflow/sources/file/options.yml b/rust/ql/test/library-tests/dataflow/sources/file/options.yml new file mode 100644 index 00000000000..673d322a0a1 --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/options.yml @@ -0,0 +1,6 @@ +qltest_cargo_check: true +qltest_dependencies: + - async-std = { version = "1.13.1" } + - bytes = { version = "1.10.1" } + - futures = { version = "0.3" } + - tokio = { version = "1.43.0", features = ["full"] } diff --git a/rust/ql/test/library-tests/dataflow/sources/file/test.rs b/rust/ql/test/library-tests/dataflow/sources/file/test.rs new file mode 100644 index 00000000000..5bbdf4db3f6 --- /dev/null +++ b/rust/ql/test/library-tests/dataflow/sources/file/test.rs @@ -0,0 +1,315 @@ +fn sink(_: T) { } + +// --- tests --- + +use std::fs; +use std::io::Read; +use tokio::io::AsyncReadExt; +use async_std::io::ReadExt; + +fn test_fs() -> Result<(), Box> { + { + let buffer: Vec = std::fs::read("file.bin")?; // $ Alert[rust/summary/taint-sources] + sink(buffer); // $ hasTaintFlow="file.bin" + } + + { + let buffer: Vec = fs::read("file.bin")?; // $ Alert[rust/summary/taint-sources] + sink(buffer); // $ hasTaintFlow="file.bin" + } + + { + let buffer = fs::read_to_string("file.txt")?; // $ Alert[rust/summary/taint-sources] + sink(buffer); // $ hasTaintFlow="file.txt" + } + + for entry in fs::read_dir("directory")? { + let e = entry?; + + let path = e.path(); // $ Alert[rust/summary/taint-sources] + sink(path.clone()); // $ hasTaintFlow + sink(path.clone().as_path()); // $ hasTaintFlow + sink(path.clone().into_os_string()); // $ MISSING: hasTaintFlow + sink(std::path::PathBuf::from(path.clone().into_boxed_path())); // $ MISSING: hasTaintFlow + sink(path.clone().as_os_str()); // $ MISSING: hasTaintFlow + sink(path.clone().as_mut_os_str()); // $ MISSING: hasTaintFlow + sink(path.to_str()); // $ MISSING: hasTaintFlow + sink(path.to_path_buf()); // $ MISSING: hasTaintFlow + sink(path.file_name().unwrap()); // $ MISSING: hasTaintFlow + sink(path.extension().unwrap()); // $ MISSING: hasTaintFlow + sink(path.canonicalize().unwrap()); // $ MISSING: hasTaintFlow + sink(path); // $ hasTaintFlow + + let file_name = e.file_name(); // $ Alert[rust/summary/taint-sources] + sink(file_name.clone()); // $ hasTaintFlow + sink(file_name.clone().into_string().unwrap()); // $ MISSING: hasTaintFlow + sink(file_name.to_str().unwrap()); // $ MISSING: hasTaintFlow + sink(file_name.to_string_lossy().to_mut()); // $ MISSING: hasTaintFlow + sink(file_name.clone().as_encoded_bytes()); // $ MISSING: hasTaintFlow + sink(file_name); // $ hasTaintFlow + } + for entry in std::path::Path::new("directory").read_dir()? { + let e = entry?; + + let path = e.path(); // $ Alert[rust/summary/taint-sources] + let file_name = e.file_name(); // $ Alert[rust/summary/taint-sources] + } + for entry in std::path::PathBuf::from("directory").read_dir()? { + let e = entry?; + + let path = e.path(); // $ MISSING: Alert[rust/summary/taint-sources] + let file_name = e.file_name(); // $ MISSING: Alert[rust/summary/taint-sources] + } + + { + let target = fs::read_link("symlink.txt")?; // $ Alert[rust/summary/taint-sources] + sink(target); // $ hasTaintFlow="symlink.txt" + } + + Ok(()) +} + +async fn test_tokio_fs() -> Result<(), Box> { + { + let buffer: Vec = tokio::fs::read("file.bin").await?; // $ Alert[rust/summary/taint-sources] + sink(buffer); // $ hasTaintFlow="file.bin" + } + + { + let buffer: Vec = tokio::fs::read("file.bin").await?; // $ Alert[rust/summary/taint-sources] + sink(buffer); // $ hasTaintFlow="file.bin" + } + + { + let buffer = tokio::fs::read_to_string("file.txt").await?; // $ Alert[rust/summary/taint-sources] + sink(buffer); // $ hasTaintFlow="file.txt" + } + + let mut read_dir = tokio::fs::read_dir("directory").await?; + for entry in read_dir.next_entry().await? { + let path = entry.path(); // $ Alert[rust/summary/taint-sources] + let file_name = entry.file_name(); // $ Alert[rust/summary/taint-sources] + sink(path); // $ hasTaintFlow + sink(file_name); // $ hasTaintFlow + } + + { + let target = tokio::fs::read_link("symlink.txt").await?; // $ Alert[rust/summary/taint-sources] + sink(target); // $ hasTaintFlow="symlink.txt" + } + + Ok(()) +} + +fn test_io_file() -> std::io::Result<()> { + // --- file --- + + let mut file = std::fs::File::open("file.txt")?; // $ Alert[rust/summary/taint-sources] + + { + let mut buffer = [0u8; 100]; + let _bytes = file.read(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = Vec::::new(); + let _bytes = file.read_to_end(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = String::new(); + let _bytes = file.read_to_string(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = [0; 100]; + file.read_exact(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + for byte in file.bytes() { + sink(byte); // $ hasTaintFlow="file.txt" + } + + // --- OpenOptions --- + + { + let mut f1 = std::fs::OpenOptions::new().open("f1.txt").unwrap(); // $ Alert[rust/summary/taint-sources] + let mut buffer = [0u8; 1024]; + let _bytes = f1.read(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="f1.txt" + } + + { + let mut f2 = std::fs::OpenOptions::new().create_new(true).open("f2.txt").unwrap(); // $ Alert[rust/summary/taint-sources] + let mut buffer = [0u8; 1024]; + let _bytes = f2.read(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="f2.txt" + } + + { + let mut f3 = std::fs::OpenOptions::new().read(true).write(true).truncate(true).create(true).open("f3.txt").unwrap(); // $ Alert[rust/summary/taint-sources] + let mut buffer = [0u8; 1024]; + let _bytes = f3.read(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="f3.txt" + } + + // --- misc operations --- + + { + let mut buffer = String::new(); + let file1 = std::fs::File::open("file.txt")?; // $ Alert[rust/summary/taint-sources] + let file2 = std::fs::File::open("another_file.txt")?; // $ Alert[rust/summary/taint-sources] + let mut reader = file1.chain(file2); + reader.read_to_string(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="file.txt" hasTaintFlow="another_file.txt" + } + + { + let mut buffer = String::new(); + let file1 = std::fs::File::open("file.txt")?; // $ Alert[rust/summary/taint-sources] + let mut reader = file1.take(100); + reader.read_to_string(&mut buffer)?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + Ok(()) +} + +async fn test_tokio_file() -> std::io::Result<()> { + // --- file --- + + let mut file = tokio::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] + + { + let mut buffer = [0u8; 100]; + let _bytes = file.read(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = Vec::::new(); + let _bytes = file.read_to_end(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = String::new(); + let _bytes = file.read_to_string(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = [0; 100]; + file.read_exact(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + { + let v1 = file.read_u8().await?; + let v2 = file.read_i16().await?; + let v3 = file.read_f32().await?; + let v4 = file.read_i64_le().await?; + sink(v1); // $ hasTaintFlow="file.txt" + sink(v2); // $ hasTaintFlow="file.txt" + sink(v3); // $ hasTaintFlow="file.txt" + sink(v4); // $ hasTaintFlow="file.txt" + } + + { + let mut buffer = bytes::BytesMut::new(); + file.read_buf(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + // --- OpenOptions --- + + { + let mut f1 = tokio::fs::OpenOptions::new().open("f1.txt").await?; // $ Alert[rust/summary/taint-sources] + let mut buffer = [0u8; 1024]; + let _bytes = f1.read(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="f1.txt" + } + + // --- misc operations --- + + { + let mut buffer = String::new(); + let file1 = tokio::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] + let file2 = tokio::fs::File::open("another_file.txt").await?; // $ Alert[rust/summary/taint-sources] + let mut reader = file1.chain(file2); + reader.read_to_string(&mut buffer).await?; + sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" hasTaintFlow="another_file.txt" -- we cannot resolve the `chain` and `read_to_string` calls above, which comes from `impl AsyncReadExt for R {}` in `async_read_ext.rs` + } + + { + let mut buffer = String::new(); + let file1 = tokio::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] + let mut reader = file1.take(100); + reader.read_to_string(&mut buffer).await?; + sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `take` and `read_to_string` calls above, which comes from `impl AsyncReadExt for R {}` in `async_read_ext.rs` + } + + Ok(()) +} + +async fn test_async_std_file() -> std::io::Result<()> { + // --- file --- + + let mut file = async_std::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] + + { + let mut buffer = [0u8; 100]; + let _bytes = file.read(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="file.txt" + } + + // --- OpenOptions --- + + { + let mut f1 = async_std::fs::OpenOptions::new().open("f1.txt").await?; // $ Alert[rust/summary/taint-sources] + let mut buffer = [0u8; 1024]; + let _bytes = f1.read(&mut buffer).await?; + sink(&buffer); // $ hasTaintFlow="f1.txt" + } + + Ok(()) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + println!("test_fs..."); + match test_fs() { + Ok(_) => println!("complete"), + Err(e) => println!("error: {}", e), + } + + println!("test_tokio_fs..."); + match futures::executor::block_on(test_tokio_fs()) { + Ok(_) => println!("complete"), + Err(e) => println!("error: {}", e), + } + + println!("test_io_file..."); + match test_io_file() { + Ok(_) => println!("complete"), + Err(e) => println!("error: {}", e), + } + + println!("test_tokio_file..."); + match futures::executor::block_on(test_tokio_file()) { + Ok(_) => println!("complete"), + Err(e) => println!("error: {}", e), + } + + println!("test_async_std_file..."); + match futures::executor::block_on(test_async_std_file()) { + Ok(_) => println!("complete"), + Err(e) => println!("error: {}", e), + } + + Ok(()) +} diff --git a/rust/ql/test/library-tests/dataflow/sources/options.yml b/rust/ql/test/library-tests/dataflow/sources/options.yml index a9ad7291126..b2f77795e81 100644 --- a/rust/ql/test/library-tests/dataflow/sources/options.yml +++ b/rust/ql/test/library-tests/dataflow/sources/options.yml @@ -7,7 +7,6 @@ qltest_dependencies: - http = { version = "1.2.0" } - tokio = { version = "1.43.0", features = ["full"] } - futures = { version = "0.3" } - - bytes = { version = "1.10.1" } - poem = { version = "3.1.10" } - serde = { version = "1.0.219" } - actix-web = { version = "4.10.2" } diff --git a/rust/ql/test/library-tests/dataflow/sources/test.rs b/rust/ql/test/library-tests/dataflow/sources/test.rs index 8413f4e144b..5f45459aa72 100644 --- a/rust/ql/test/library-tests/dataflow/sources/test.rs +++ b/rust/ql/test/library-tests/dataflow/sources/test.rs @@ -347,282 +347,6 @@ async fn test_tokio_stdin() -> Result<(), Box> { Ok(()) } -use std::fs; - -fn test_fs() -> Result<(), Box> { - { - let buffer: Vec = std::fs::read("file.bin")?; // $ Alert[rust/summary/taint-sources] - sink(buffer); // $ hasTaintFlow="file.bin" - } - - { - let buffer: Vec = fs::read("file.bin")?; // $ Alert[rust/summary/taint-sources] - sink(buffer); // $ hasTaintFlow="file.bin" - } - - { - let buffer = fs::read_to_string("file.txt")?; // $ Alert[rust/summary/taint-sources] - sink(buffer); // $ hasTaintFlow="file.txt" - } - - for entry in fs::read_dir("directory")? { - let e = entry?; - - let path = e.path(); // $ Alert[rust/summary/taint-sources] - sink(path.clone()); // $ hasTaintFlow - sink(path.clone().as_path()); // $ hasTaintFlow - sink(path.clone().into_os_string()); // $ MISSING: hasTaintFlow - sink(std::path::PathBuf::from(path.clone().into_boxed_path())); // $ MISSING: hasTaintFlow - sink(path.clone().as_os_str()); // $ MISSING: hasTaintFlow - sink(path.clone().as_mut_os_str()); // $ MISSING: hasTaintFlow - sink(path.to_str()); // $ MISSING: hasTaintFlow - sink(path.to_path_buf()); // $ MISSING: hasTaintFlow - sink(path.file_name().unwrap()); // $ MISSING: hasTaintFlow - sink(path.extension().unwrap()); // $ MISSING: hasTaintFlow - sink(path.canonicalize().unwrap()); // $ MISSING: hasTaintFlow - sink(path); // $ hasTaintFlow - - let file_name = e.file_name(); // $ Alert[rust/summary/taint-sources] - sink(file_name.clone()); // $ hasTaintFlow - sink(file_name.clone().into_string().unwrap()); // $ MISSING: hasTaintFlow - sink(file_name.to_str().unwrap()); // $ MISSING: hasTaintFlow - sink(file_name.to_string_lossy().to_mut()); // $ MISSING: hasTaintFlow - sink(file_name.clone().as_encoded_bytes()); // $ MISSING: hasTaintFlow - sink(file_name); // $ hasTaintFlow - } - for entry in std::path::Path::new("directory").read_dir()? { - let e = entry?; - - let path = e.path(); // $ Alert[rust/summary/taint-sources] - let file_name = e.file_name(); // $ Alert[rust/summary/taint-sources] - } - for entry in std::path::PathBuf::from("directory").read_dir()? { - let e = entry?; - - let path = e.path(); // $ MISSING: Alert[rust/summary/taint-sources] - let file_name = e.file_name(); // $ MISSING: Alert[rust/summary/taint-sources] - } - - { - let target = fs::read_link("symlink.txt")?; // $ Alert[rust/summary/taint-sources] - sink(target); // $ hasTaintFlow="symlink.txt" - } - - Ok(()) -} - -async fn test_tokio_fs() -> Result<(), Box> { - { - let buffer: Vec = tokio::fs::read("file.bin").await?; // $ Alert[rust/summary/taint-sources] - sink(buffer); // $ hasTaintFlow="file.bin" - } - - { - let buffer: Vec = tokio::fs::read("file.bin").await?; // $ Alert[rust/summary/taint-sources] - sink(buffer); // $ hasTaintFlow="file.bin" - } - - { - let buffer = tokio::fs::read_to_string("file.txt").await?; // $ Alert[rust/summary/taint-sources] - sink(buffer); // $ hasTaintFlow="file.txt" - } - - let mut read_dir = tokio::fs::read_dir("directory").await?; - for entry in read_dir.next_entry().await? { - let path = entry.path(); // $ Alert[rust/summary/taint-sources] - let file_name = entry.file_name(); // $ Alert[rust/summary/taint-sources] - sink(path); // $ hasTaintFlow - sink(file_name); // $ hasTaintFlow - } - - { - let target = tokio::fs::read_link("symlink.txt").await?; // $ Alert[rust/summary/taint-sources] - sink(target); // $ hasTaintFlow="symlink.txt" - } - - Ok(()) -} - -fn test_io_file() -> std::io::Result<()> { - // --- file --- - - let mut file = std::fs::File::open("file.txt")?; // $ Alert[rust/summary/taint-sources] - - { - let mut buffer = [0u8; 100]; - let _bytes = file.read(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = Vec::::new(); - let _bytes = file.read_to_end(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = String::new(); - let _bytes = file.read_to_string(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = [0; 100]; - file.read_exact(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - for byte in file.bytes() { - sink(byte); // $ hasTaintFlow="file.txt" - } - - // --- OpenOptions --- - - { - let mut f1 = std::fs::OpenOptions::new().open("f1.txt").unwrap(); // $ Alert[rust/summary/taint-sources] - let mut buffer = [0u8; 1024]; - let _bytes = f1.read(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="f1.txt" - } - - { - let mut f2 = std::fs::OpenOptions::new().create_new(true).open("f2.txt").unwrap(); // $ Alert[rust/summary/taint-sources] - let mut buffer = [0u8; 1024]; - let _bytes = f2.read(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="f2.txt" - } - - { - let mut f3 = std::fs::OpenOptions::new().read(true).write(true).truncate(true).create(true).open("f3.txt").unwrap(); // $ Alert[rust/summary/taint-sources] - let mut buffer = [0u8; 1024]; - let _bytes = f3.read(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="f3.txt" - } - - // --- misc operations --- - - { - let mut buffer = String::new(); - let file1 = std::fs::File::open("file.txt")?; // $ Alert[rust/summary/taint-sources] - let file2 = std::fs::File::open("another_file.txt")?; // $ Alert[rust/summary/taint-sources] - let mut reader = file1.chain(file2); - reader.read_to_string(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="file.txt" hasTaintFlow="another_file.txt" - } - - { - let mut buffer = String::new(); - let file1 = std::fs::File::open("file.txt")?; // $ Alert[rust/summary/taint-sources] - let mut reader = file1.take(100); - reader.read_to_string(&mut buffer)?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - Ok(()) -} - -async fn test_tokio_file() -> std::io::Result<()> { - // --- file --- - - let mut file = tokio::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] - - { - let mut buffer = [0u8; 100]; - let _bytes = file.read(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = Vec::::new(); - let _bytes = file.read_to_end(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = String::new(); - let _bytes = file.read_to_string(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = [0; 100]; - file.read_exact(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - { - let v1 = file.read_u8().await?; - let v2 = file.read_i16().await?; - let v3 = file.read_f32().await?; - let v4 = file.read_i64_le().await?; - sink(v1); // $ hasTaintFlow="file.txt" - sink(v2); // $ hasTaintFlow="file.txt" - sink(v3); // $ hasTaintFlow="file.txt" - sink(v4); // $ hasTaintFlow="file.txt" - } - - { - let mut buffer = bytes::BytesMut::new(); - file.read_buf(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - // --- OpenOptions --- - - { - let mut f1 = tokio::fs::OpenOptions::new().open("f1.txt").await?; // $ Alert[rust/summary/taint-sources] - let mut buffer = [0u8; 1024]; - let _bytes = f1.read(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="f1.txt" - } - - // --- misc operations --- - - { - let mut buffer = String::new(); - let file1 = tokio::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] - let file2 = tokio::fs::File::open("another_file.txt").await?; // $ Alert[rust/summary/taint-sources] - let mut reader = file1.chain(file2); - reader.read_to_string(&mut buffer).await?; - sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" hasTaintFlow="another_file.txt" -- we cannot resolve the `chain` and `read_to_string` calls above, which comes from `impl AsyncReadExt for R {}` in `async_read_ext.rs` - } - - { - let mut buffer = String::new(); - let file1 = tokio::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] - let mut reader = file1.take(100); - reader.read_to_string(&mut buffer).await?; - sink(&buffer); // $ MISSING: hasTaintFlow="file.txt" -- we cannot resolve the `take` and `read_to_string` calls above, which comes from `impl AsyncReadExt for R {}` in `async_read_ext.rs` - } - - Ok(()) -} - -use async_std::io::ReadExt; - -async fn test_async_std_file() -> std::io::Result<()> { - // --- file --- - - let mut file = async_std::fs::File::open("file.txt").await?; // $ Alert[rust/summary/taint-sources] - - { - let mut buffer = [0u8; 100]; - let _bytes = file.read(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="file.txt" - } - - // --- OpenOptions --- - - { - let mut f1 = async_std::fs::OpenOptions::new().open("f1.txt").await?; // $ Alert[rust/summary/taint-sources] - let mut buffer = [0u8; 1024]; - let _bytes = f1.read(&mut buffer).await?; - sink(&buffer); // $ hasTaintFlow="f1.txt" - } - - Ok(()) -} - use std::net::ToSocketAddrs; async fn test_std_tcpstream(case: i64) -> std::io::Result<()> { @@ -1065,36 +789,6 @@ async fn main() -> Result<(), Box> { Err(e) => println!("error: {}", e), } - println!("test_fs..."); - match test_fs() { - Ok(_) => println!("complete"), - Err(e) => println!("error: {}", e), - } - - println!("test_tokio_fs..."); - match futures::executor::block_on(test_tokio_fs()) { - Ok(_) => println!("complete"), - Err(e) => println!("error: {}", e), - } - - println!("test_io_file..."); - match test_io_file() { - Ok(_) => println!("complete"), - Err(e) => println!("error: {}", e), - } - - println!("test_tokio_file..."); - match futures::executor::block_on(test_tokio_file()) { - Ok(_) => println!("complete"), - Err(e) => println!("error: {}", e), - } - - println!("test_async_std_file..."); - match futures::executor::block_on(test_async_std_file()) { - Ok(_) => println!("complete"), - Err(e) => println!("error: {}", e), - } - println!("test_std_tcpstream..."); match futures::executor::block_on(test_std_tcpstream(case)) { Ok(_) => println!("complete"),