diff --git a/.devcontainer/post-create-script.sh b/.devcontainer/post-create-script.sh index 3da76b3dc..e07e790e1 100755 --- a/.devcontainer/post-create-script.sh +++ b/.devcontainer/post-create-script.sh @@ -18,7 +18,7 @@ sudo npm install -g azurite # Restore rust dependencies echo "Restoring rust dependencies" -cargo install cargo-audit cargo-license # requirements if you want to run ci/agent.sh +cargo install cargo-audit cargo-license@0.4.2 # requirements if you want to run ci/agent.sh cd /workspaces/onefuzz/src/agent cargo fetch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 146d4b844..5d45b08c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v2 - name: Install specific Rust version run: | - rustup default 1.62 + rustup default 1.63 rustup component add clippy rustfmt - name: Get Rust version & build version shell: bash diff --git a/src/agent/coverage/examples/coverage.rs b/src/agent/coverage/examples/coverage.rs index 227579b10..b4dcc44b5 100644 --- a/src/agent/coverage/examples/coverage.rs +++ b/src/agent/coverage/examples/coverage.rs @@ -81,7 +81,7 @@ fn input_command(argv: &[String], input: &Path) -> Command { let args: Vec<_> = argv[1..] .iter() .map(|a| { - if &*a == "@@" { + if a == "@@" { input.display().to_string() } else { a.to_string() diff --git a/src/agent/coverage/examples/src-cov.rs b/src/agent/coverage/examples/src-cov.rs index 3e8dba158..789a29dd3 100644 --- a/src/agent/coverage/examples/src-cov.rs +++ b/src/agent/coverage/examples/src-cov.rs @@ -80,7 +80,7 @@ fn input_command(argv: &[String], input: &Path) -> Command { let args: Vec<_> = argv[1..] .iter() .map(|a| { - if &*a == "@@" { + if a == "@@" { input.display().to_string() } else { a.to_string() diff --git a/src/agent/coverage/src/report.rs b/src/agent/coverage/src/report.rs index 8749d7cca..d4a93ad76 100644 --- a/src/agent/coverage/src/report.rs +++ b/src/agent/coverage/src/report.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; /// /// Coverage is reported as a sequence of module coverage entries, which are /// generic in a coverage type `C` and a metadata type `M`. -#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)] #[serde(transparent)] pub struct CoverageReport { /// Coverage data for each module. @@ -29,7 +29,7 @@ pub struct CoverageReport { /// /// Warning: `serde` allows duplicate keys. If `M` and `C` share field names as /// structs, then the serialized entry will have duplicate keys. -#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)] pub struct CoverageReportEntry { /// Path or name of the module. pub module: String, diff --git a/src/agent/debugger/src/dbghelp.rs b/src/agent/debugger/src/dbghelp.rs index 1cacc5b4f..f64c91e25 100644 --- a/src/agent/debugger/src/dbghelp.rs +++ b/src/agent/debugger/src/dbghelp.rs @@ -418,7 +418,7 @@ impl ModuleInfo { } } -#[derive(Clone, Debug, Hash, PartialEq)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct SymInfo { pub symbol: String, pub address: u64, diff --git a/src/agent/debugger/src/module.rs b/src/agent/debugger/src/module.rs index df7d27a9c..271a99da7 100644 --- a/src/agent/debugger/src/module.rs +++ b/src/agent/debugger/src/module.rs @@ -168,7 +168,7 @@ impl Module { } } -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Machine { Unknown, X64, diff --git a/src/agent/debugger/src/stack.rs b/src/agent/debugger/src/stack.rs index c37ea2b0a..bc1ae42a9 100644 --- a/src/agent/debugger/src/stack.rs +++ b/src/agent/debugger/src/stack.rs @@ -18,7 +18,7 @@ use crate::dbghelp::{self, DebugHelpGuard, ModuleInfo, SymInfo, SymLineInfo}; const UNKNOWN_MODULE: &str = ""; /// The file and line number for frames in the call stack. -#[derive(Clone, Debug, Hash, PartialEq)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct FileInfo { pub file: String, pub line: u32, @@ -38,7 +38,7 @@ impl From<&SymLineInfo> for FileInfo { } } -#[derive(Clone, Debug, Hash, PartialEq)] +#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub enum DebugStackFrame { Frame { module_name: String, @@ -118,7 +118,7 @@ impl Serialize for DebugStackFrame { } } -#[derive(Debug, PartialEq, Serialize)] +#[derive(Debug, PartialEq, Serialize, Eq)] pub struct DebugStack { pub frames: Vec, } diff --git a/src/agent/debugger/src/target.rs b/src/agent/debugger/src/target.rs index fbcae4bce..5e0407839 100644 --- a/src/agent/debugger/src/target.rs +++ b/src/agent/debugger/src/target.rs @@ -148,7 +148,7 @@ impl ThreadInfo { } } -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] enum SymInitalizeState { NotInitialized, InitializeNeeded, diff --git a/src/agent/input-tester/src/appverifier.rs b/src/agent/input-tester/src/appverifier.rs index ffab88b5a..27ea8de02 100644 --- a/src/agent/input-tester/src/appverifier.rs +++ b/src/agent/input-tester/src/appverifier.rs @@ -882,7 +882,7 @@ impl ArgsWithComments { } } -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum AppVerifierState { Enabled, Disabled, @@ -906,7 +906,7 @@ impl AppVerifierController { for test in app_verifier_tests.iter() { enable_args.arg(format!("{}", test)); - for stop_code in stop_codes(AppVerifierTest::from_str(&*test)?) { + for stop_code in stop_codes(AppVerifierTest::from_str(test)?) { configure_args.arg(format!("0x{:x}", *stop_code)); } } diff --git a/src/agent/input-tester/src/test_result/mod.rs b/src/agent/input-tester/src/test_result/mod.rs index a3a08802d..52456ea61 100644 --- a/src/agent/input-tester/src/test_result/mod.rs +++ b/src/agent/input-tester/src/test_result/mod.rs @@ -234,7 +234,7 @@ impl fmt::Display for Exception { } /// How did the program exit - normally (so we have a proper exit code) or was it terminated? -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum ExitStatus { /// The exit code returned from the process. Code(i32), diff --git a/src/agent/onefuzz/src/expand.rs b/src/agent/onefuzz/src/expand.rs index 7ff65ce05..d0986d615 100644 --- a/src/agent/onefuzz/src/expand.rs +++ b/src/agent/onefuzz/src/expand.rs @@ -14,9 +14,11 @@ pub enum ExpandedValue<'a> { Path(String), Scalar(String), List(&'a [String]), - Mapping(Box, &str) -> Result>> + Send>), + Mapping(MappingFn<'a>), } +type MappingFn<'a> = Box, &str) -> Result>> + Send>; + #[derive(PartialEq, Eq, Hash, EnumIter)] pub enum PlaceHolder { Input, diff --git a/src/agent/win-util/src/pipe_handle.rs b/src/agent/win-util/src/pipe_handle.rs index 7462d52d5..48899c4d8 100644 --- a/src/agent/win-util/src/pipe_handle.rs +++ b/src/agent/win-util/src/pipe_handle.rs @@ -174,6 +174,7 @@ mod tests { } #[test] + #[allow(clippy::read_zero_byte_vec)] fn read_empty_pipe() { let (reader, _writer) = pipe().unwrap(); let mut buf = vec![]; diff --git a/src/ci/agent.sh b/src/ci/agent.sh index aa53f9bcf..12b8669c1 100755 --- a/src/ci/agent.sh +++ b/src/ci/agent.sh @@ -38,6 +38,7 @@ cargo --version cargo audit --version cargo clippy --version cargo fmt --version +cargo-license --version # unless we're doing incremental builds, start clean during CI if [ X${CARGO_INCREMENTAL} == X ]; then @@ -52,7 +53,8 @@ cargo fmt -- --check # RUSTSEC-2020-0077: `memmap` dependency unmaintained, via `symbolic` (see: `getsentry/symbolic#304`) # RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366) # RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366) -cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2020-0036 --ignore RUSTSEC-2019-0036 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0077 +# RUSTSEC-2022-0048: xml-rs is unmaintained +cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2020-0036 --ignore RUSTSEC-2019-0036 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0077 --ignore RUSTSEC-2022-0048 cargo-license -j > data/licenses.json cargo build --release --locked cargo clippy --release --locked --all-targets -- -D warnings diff --git a/src/ci/proxy.sh b/src/ci/proxy.sh index d30dbf3e9..f833f7528 100755 --- a/src/ci/proxy.sh +++ b/src/ci/proxy.sh @@ -16,7 +16,8 @@ cargo clippy --release --all-targets -- -D warnings # RUSTSEC-2021-0065: a dependency `anymap` is no longer supported # RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366) # RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366) -cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 +# RUSTSEC-2022-0048: xml-rs is unmaintained +cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2022-0048 cargo-license -j > data/licenses.json cargo build --release --locked # export RUST_LOG=trace diff --git a/src/ci/rust-prereqs.sh b/src/ci/rust-prereqs.sh index a00c45526..f3ab4c55b 100755 --- a/src/ci/rust-prereqs.sh +++ b/src/ci/rust-prereqs.sh @@ -14,5 +14,5 @@ fi cargo install cargo-audit if ! cargo-license --help; then - cargo install cargo-license + cargo install cargo-license@0.4.2 fi diff --git a/src/proxy-manager/src/config.rs b/src/proxy-manager/src/config.rs index 92478c756..e93a7b7a3 100644 --- a/src/proxy-manager/src/config.rs +++ b/src/proxy-manager/src/config.rs @@ -35,14 +35,14 @@ pub enum ProxyError { }, } -#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)] pub struct Forward { pub src_port: u16, pub dst_ip: String, pub dst_port: u16, } -#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)] pub struct ConfigData { pub instance_id: Uuid, pub instance_telemetry_key: Option, @@ -54,7 +54,7 @@ pub struct ConfigData { pub forwards: Vec, } -#[derive(Debug, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct NotifyResponse<'a> { pub region: &'a str, pub proxy_id: Uuid,