From dbd94606e34775926c3ee11c6a4d49f640e8ca48 Mon Sep 17 00:00:00 2001 From: Jack Wampler Date: Wed, 18 Sep 2024 15:23:35 -0600 Subject: [PATCH] Fix dependabot issues (#64) get things running again --- .github/workflows/rust.yml | 4 ++-- Makefile | 5 +++++ README.md | 16 +++++++++------- crates/obfs4/Cargo.toml | 11 ++++++----- crates/obfs4/src/common/probdist.rs | 2 ++ crates/obfs4/src/common/replay_filter.rs | 2 +- crates/obfs4/src/common/skip.rs | 4 +++- crates/obfs4/src/common/x25519_elligator2.rs | 6 +++--- crates/ptrs/Cargo.toml | 2 +- crates/ptrs/src/helpers.rs | 11 +++++++---- 10 files changed, 39 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0f63884..431f6d8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -104,12 +104,12 @@ jobs: - run: cargo update -Z minimal-versions # Now check that `cargo build` works with respect to the oldest possible # deps and the stated MSRV. 1.70 should work for all - - uses: dtolnay/rust-toolchain@1.70.0 + - uses: dtolnay/rust-toolchain@1.75.0 - run: cargo test --workspace --all-targets --all-features # Also make sure the AVX2 build works - run: cargo build --target x86_64-unknown-linux-gnu # The PTRS crate has fewer dependencies and a lower msrv - - uses: dtolnay/rust-toolchain@1.63 + - uses: dtolnay/rust-toolchain@1.70 - run: cargo test -p ptrs --all-targets --all-features - run: cargo build -p ptrs --target x86_64-unknown-linux-gnu diff --git a/Makefile b/Makefile index 9b384ab..58f066b 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,8 @@ docker: release: cargo build --release + +msrv: + cargo +1.70 test -p ptrs --all-targets --all-features + cargo +1.75 test --workspace --all-targets --all-features + diff --git a/README.md b/README.md index 883f500..71de48f 100644 --- a/README.md +++ b/README.md @@ -20,19 +20,20 @@ lyrebird binary, and Pluggable Transports in Rust (PTRS) library. | Crate | Description | Crates.io | Docs | MSRV | -------------------------------------------|----------------|-----------|------|------| -| [`ptrs`](./crates/ptrs) | A library supporting implementation and integration of Pluggable Transport protocols. | [![](https://img.shields.io/crates/v/ptrs.svg)](https://crates.io/crates/ptrs) | [![](https://img.shields.io/docsrs/ptrs)](https://docs.rs/ptrs) | 1.63 | -| [`lyrebird`](./crates/lyrebird) | Implementation of the `Lyrebird` Tor bridge and a forward proxy compatible with `ptrs`. | [![](https://img.shields.io/crates/v/lyrebird.svg)](https://crates.io/crates/lyrebird) | [![](https://docs.rs/lyrebird/badge.svg)](https://docs.rs/lyrebird) | 1.70 | -| [`obfs4`](./crates/obfs4) | An implementation of obfs4 pluggable transport library in pure rust. | [![](https://img.shields.io/crates/v/obfs4.svg)](https://crates.io/crates/obfs4) | [![](https://docs.rs/obfs4/badge.svg)](https://docs.rs/obfs4) | 1.70 | +| [`ptrs`](./crates/ptrs) | A library supporting implementation and integration of Pluggable Transport protocols. | [![](https://img.shields.io/crates/v/ptrs.svg)](https://crates.io/crates/ptrs) | [![](https://img.shields.io/docsrs/ptrs)](https://docs.rs/ptrs) | 1.70 | +| [`lyrebird`](./crates/lyrebird) | Implementation of the `Lyrebird` Tor bridge and a forward proxy compatible with `ptrs`. | [![](https://img.shields.io/crates/v/lyrebird.svg)](https://crates.io/crates/lyrebird) | [![](https://docs.rs/lyrebird/badge.svg)](https://docs.rs/lyrebird) | 1.75 | +| [`obfs4`](./crates/obfs4) | An implementation of obfs4 pluggable transport library in pure rust. | [![](https://img.shields.io/crates/v/obfs4.svg)](https://crates.io/crates/obfs4) | [![](https://docs.rs/obfs4/badge.svg)](https://docs.rs/obfs4) | 1.75 | ## MSRV The Minimum Supported Rust Versions (MSRV) for the various crates are listed above. -These are ensured by test and build steps in the CI pipeline. +These are ensured by test and build steps in the CI pipeline. -MSRV can be changed in the future, but it will be done with a minor version bump. -We will not increase MSRV on PATCH releases, though downstream dependencies might. +Once these crates reach a semi-stable state any changes to MSRV will be accompanied +with a minor version bump. We will not increase MSRV on PATCH releases, though downstream +dependencies might. -We won't increase MSRV just because we can: we'll only do so when we have a +Along these lines, we won't increase MSRV just because we can: we'll only do so when we have a reason. (We don't guarantee that you'll agree with our reasoning; only that it will exist.) @@ -40,6 +41,7 @@ it will exist.) Things to keep an eye on: +- [X] [`kemeleon`](https://github.com/jmwample/kemeleon) crate implementing the [Kemeleon ML-KEM Key obfuscation algorithm(s)](https://eprint.iacr.org/2024/1086.pdf). - [ ] PR implementating elligator2 for the `dalek` ed25519 library. [PR Here](https://github.com/dalek-cryptography/curve25519-dalek/pull/612) ## Open Source License diff --git a/crates/obfs4/Cargo.toml b/crates/obfs4/Cargo.toml index 0c844f2..ef59b93 100644 --- a/crates/obfs4/Cargo.toml +++ b/crates/obfs4/Cargo.toml @@ -54,10 +54,10 @@ tokio-util = { version = "0.7.10", features = ["codec", "io"]} bytes = "1.5.0" ## ntor_arti -tor-cell = "0.20.0" -tor-llcrypto = "0.20.0" -tor-error = "0.20.0" -tor-bytes = "0.20.0" +tor-cell = "0.22.0" +tor-llcrypto = "0.22.0" +tor-error = "0.22.0" +tor-bytes = "0.22.0" cipher = "0.4.4" zeroize = "1.7.0" thiserror = "1.0.56" @@ -71,6 +71,7 @@ anyhow = { version="1.0.20", optional=true} async-trait = { version="0.1.9", optional=true} num-bigint = { version="0.4.2", optional=true} simple_asn1 = { version="0.6.1", optional=true} +filetime = {version="0.2.25", optional=true} ## Maybe useful in future iterations # tor-socksproto = { version = "0.10.0" } @@ -80,7 +81,7 @@ simple_asn1 = { version="0.6.1", optional=true} [dev-dependencies] tracing-subscriber = "0.3.18" hex-literal = "0.4.1" -tor-basic-utils = "0.20.0" +tor-basic-utils = "0.22.0" # benches # criterion = "0.5" diff --git a/crates/obfs4/src/common/probdist.rs b/crates/obfs4/src/common/probdist.rs index d2a176a..d674999 100644 --- a/crates/obfs4/src/common/probdist.rs +++ b/crates/obfs4/src/common/probdist.rs @@ -1,3 +1,5 @@ +//! Weighted probability distribution +//! //! The probdist module implements a weighted probability distribution suitable for //! protocol parameterization. To allow for easy reproduction of a given //! distribution, the drbg package is used as the random number source. diff --git a/crates/obfs4/src/common/replay_filter.rs b/crates/obfs4/src/common/replay_filter.rs index 400484f..3422c8a 100644 --- a/crates/obfs4/src/common/replay_filter.rs +++ b/crates/obfs4/src/common/replay_filter.rs @@ -245,7 +245,7 @@ mod test { f.filter.len() ); assert!( - !f.test_and_set(now, &format!("message-1{i}")), + !f.test_and_set(now, format!("message-1{i}")), "unique message failed insert (returned true)" ); } diff --git a/crates/obfs4/src/common/skip.rs b/crates/obfs4/src/common/skip.rs index a2538ea..f86c9b3 100644 --- a/crates/obfs4/src/common/skip.rs +++ b/crates/obfs4/src/common/skip.rs @@ -6,7 +6,9 @@ use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt}; // use std::task::{Context, Poll}; use std::time::Duration; -/// copies all data from the reader to a sink. If the reader closes before +/// Copies all data from the reader to a sink. +/// +/// If the reader closes before /// the timeout due to na error or an EoF that result will be returned. /// Otherwise if the timeout is reached, the stream will be shutdown /// and the result of that shutdown will be returned. diff --git a/crates/obfs4/src/common/x25519_elligator2.rs b/crates/obfs4/src/common/x25519_elligator2.rs index a5ecf96..85ddef4 100644 --- a/crates/obfs4/src/common/x25519_elligator2.rs +++ b/crates/obfs4/src/common/x25519_elligator2.rs @@ -154,9 +154,9 @@ use rand_core::{CryptoRng, RngCore}; pub const REPRESENTATIVE_LENGTH: usize = 32; -/// A collection of functions for generating x25519 keys wrapping `x25519_dalek`. ['EphemeralSecret'] -/// keys are guaranteed to have a valid elligator2 representative. In general ['StaticSecret'] should -/// not be converted to PublicRepresentative, use an EphemeralSecret instead. +/// A collection of functions for generating x25519 keys wrapping `x25519_dalek`. +// ['EphemeralSecret'] keys are guaranteed to have a valid elligator2 representative. In general +// ['StaticSecret'] should not be converted to PublicRepresentative, use an EphemeralSecret instead. pub struct Keys; trait RetryLimit { diff --git a/crates/ptrs/Cargo.toml b/crates/ptrs/Cargo.toml index aabef24..219584a 100644 --- a/crates/ptrs/Cargo.toml +++ b/crates/ptrs/Cargo.toml @@ -24,7 +24,7 @@ futures = "0.3.30" itertools = "0.13.0" subtle = "2.5.0" thiserror = "1" -tokio = { version = "1.34", features = ["full"] } +tokio = { version = "1.40", features = ["full"] } tracing = "0.1.40" url = "2.5.0" diff --git a/crates/ptrs/src/helpers.rs b/crates/ptrs/src/helpers.rs index 18b75b3..f5c7692 100644 --- a/crates/ptrs/src/helpers.rs +++ b/crates/ptrs/src/helpers.rs @@ -63,10 +63,11 @@ pub fn is_client() -> Result { } } -/// Return the directory name in the TOR_PT_STATE_LOCATION environment variable, -/// creating it if it doesn't exist. Returns non-nil error if -/// `TOR_PT_STATE_LOCATION` is not set or if there is an error creating the -/// directory. +/// Get the state directory from env, create if it doesnt exist. +/// +/// Return the directory name in the TOR_PT_STATE_LOCATION environment variable, creating it +/// if it doesn't exist. Returns non-nil error if `TOR_PT_STATE_LOCATION` is not set or if +/// there is an error creating the directory. pub fn make_state_dir() -> Result { let path = env::var(constants::STATE_LOCATION) .map_err(|_| to_io_other("missing required TOR_PT_STATE_LOCATION env var"))?; @@ -244,6 +245,8 @@ pub(crate) fn validate_proxy_url(spec: &Url) -> Result<(), Error> { // Server // // ================================================================ // +/// Tor OR Server Information +/// /// Check the server pluggable transports environment, emitting an error message /// and returning a non-nil error if any error is encountered. Resolves the /// various requested bind addresses, the server ORPort and extended ORPort, and