fix: deny advisory RUSTSEC-2024-0421 (#13227)

Signed-off-by: Gregory Edison <gregory.edison1993@gmail.com>
This commit is contained in:
greg
2024-12-09 15:14:45 +01:00
committed by GitHub
parent 13302ca655
commit 233f893a93
3 changed files with 101 additions and 91 deletions

170
Cargo.lock generated
View File

@ -1112,6 +1112,17 @@ dependencies = [
"zstd-safe", "zstd-safe",
] ]
[[package]]
name = "async-recursion"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.90",
]
[[package]] [[package]]
name = "async-sse" name = "async-sse"
version = "5.1.0" version = "5.1.0"
@ -3666,6 +3677,54 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
[[package]]
name = "hickory-proto"
version = "0.25.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d063c0692ee669aa6d261988aa19ca5510f1cc40e4f211024f50c888499a35d7"
dependencies = [
"async-recursion",
"async-trait",
"cfg-if",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna",
"ipnet",
"once_cell",
"rand 0.8.5",
"serde",
"thiserror 2.0.5",
"tinyvec",
"tokio",
"tracing",
"url",
]
[[package]]
name = "hickory-resolver"
version = "0.25.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42bc352e4412fb657e795f79b4efcf2bd60b59ee5ca0187f3554194cd1107a27"
dependencies = [
"cfg-if",
"futures-util",
"hickory-proto",
"ipconfig",
"moka",
"once_cell",
"parking_lot",
"rand 0.8.5",
"resolv-conf",
"serde",
"smallvec",
"thiserror 2.0.5",
"tokio",
"tracing",
]
[[package]] [[package]]
name = "hkdf" name = "hkdf"
version = "0.12.4" version = "0.12.4"
@ -4053,16 +4112,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]] [[package]]
name = "idna" name = "idna"
version = "1.0.3" version = "1.0.3"
@ -4818,15 +4867,6 @@ dependencies = [
"hashbrown 0.15.2", "hashbrown 0.15.2",
] ]
[[package]]
name = "lru-cache"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c"
dependencies = [
"linked-hash-map",
]
[[package]] [[package]]
name = "lz4_flex" name = "lz4_flex"
version = "0.11.3" version = "0.11.3"
@ -5071,6 +5111,26 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "moka"
version = "0.12.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f"
dependencies = [
"crossbeam-channel",
"crossbeam-epoch",
"crossbeam-utils",
"once_cell",
"parking_lot",
"quanta",
"rustc_version 0.4.1",
"smallvec",
"tagptr",
"thiserror 1.0.69",
"triomphe",
"uuid",
]
[[package]] [[package]]
name = "more-asserts" name = "more-asserts"
version = "0.3.1" version = "0.3.1"
@ -7098,6 +7158,7 @@ dependencies = [
"alloy-rlp", "alloy-rlp",
"data-encoding", "data-encoding",
"enr", "enr",
"hickory-resolver",
"linked_hash_set", "linked_hash_set",
"parking_lot", "parking_lot",
"rand 0.8.5", "rand 0.8.5",
@ -7114,7 +7175,6 @@ dependencies = [
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tracing", "tracing",
"trust-dns-resolver",
] ]
[[package]] [[package]]
@ -10725,6 +10785,12 @@ dependencies = [
"windows 0.57.0", "windows 0.57.0",
] ]
[[package]]
name = "tagptr"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]] [[package]]
name = "tap" name = "tap"
version = "1.0.1" version = "1.0.1"
@ -11323,51 +11389,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "trust-dns-proto" name = "triomphe"
version = "0.23.2" version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3"
dependencies = [
"async-trait",
"cfg-if",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna 0.4.0",
"ipnet",
"once_cell",
"rand 0.8.5",
"smallvec",
"thiserror 1.0.69",
"tinyvec",
"tokio",
"tracing",
"url",
]
[[package]]
name = "trust-dns-resolver"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6"
dependencies = [
"cfg-if",
"futures-util",
"ipconfig",
"lru-cache",
"once_cell",
"parking_lot",
"rand 0.8.5",
"resolv-conf",
"serde",
"smallvec",
"thiserror 1.0.69",
"tokio",
"tracing",
"trust-dns-proto",
]
[[package]] [[package]]
name = "try-lock" name = "try-lock"
@ -11443,27 +11468,12 @@ version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df"
[[package]]
name = "unicode-bidi"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.14" version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]]
name = "unicode-normalization"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
dependencies = [
"tinyvec",
]
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.12.0" version = "1.12.0"
@ -11528,7 +11538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna 1.0.3", "idna",
"percent-encoding", "percent-encoding",
"serde", "serde",
] ]

View File

@ -27,7 +27,7 @@ tokio = { workspace = true, features = ["io-util", "net", "time"] }
tokio-stream.workspace = true tokio-stream.workspace = true
# trust-dns # trust-dns
trust-dns-resolver = "0.23" hickory-resolver = { version = "0.25.0-alpha.4" }
# misc # misc
data-encoding = "2" data-encoding = "2"
@ -58,6 +58,6 @@ serde = [
"parking_lot/serde", "parking_lot/serde",
"rand/serde", "rand/serde",
"secp256k1/serde", "secp256k1/serde",
"trust-dns-resolver/serde", "hickory-resolver/serde",
"reth-ethereum-forks/serde" "reth-ethereum-forks/serde"
] ]

View File

@ -1,10 +1,10 @@
//! Perform DNS lookups //! Perform DNS lookups
use hickory_resolver::name_server::ConnectionProvider;
pub use hickory_resolver::{ResolveError, TokioResolver};
use parking_lot::RwLock; use parking_lot::RwLock;
use std::{collections::HashMap, future::Future}; use std::{collections::HashMap, future::Future};
use tracing::trace; use tracing::trace;
pub use trust_dns_resolver::{error::ResolveError, TokioAsyncResolver};
use trust_dns_resolver::{name_server::ConnectionProvider, AsyncResolver};
/// A type that can lookup DNS entries /// A type that can lookup DNS entries
pub trait Resolver: Send + Sync + Unpin + 'static { pub trait Resolver: Send + Sync + Unpin + 'static {
@ -12,7 +12,7 @@ pub trait Resolver: Send + Sync + Unpin + 'static {
fn lookup_txt(&self, query: &str) -> impl Future<Output = Option<String>> + Send; fn lookup_txt(&self, query: &str) -> impl Future<Output = Option<String>> + Send;
} }
impl<P: ConnectionProvider> Resolver for AsyncResolver<P> { impl<P: ConnectionProvider> Resolver for hickory_resolver::Resolver<P> {
async fn lookup_txt(&self, query: &str) -> Option<String> { async fn lookup_txt(&self, query: &str) -> Option<String> {
// See: [AsyncResolver::txt_lookup] // See: [AsyncResolver::txt_lookup]
// > *hint* queries that end with a '.' are fully qualified names and are cheaper lookups // > *hint* queries that end with a '.' are fully qualified names and are cheaper lookups
@ -33,7 +33,7 @@ impl<P: ConnectionProvider> Resolver for AsyncResolver<P> {
/// An asynchronous DNS resolver /// An asynchronous DNS resolver
/// ///
/// See also [`TokioAsyncResolver`] /// See also [`TokioResolver`]
/// ///
/// ``` /// ```
/// # fn t() { /// # fn t() {
@ -43,16 +43,16 @@ impl<P: ConnectionProvider> Resolver for AsyncResolver<P> {
/// ``` /// ```
/// ///
/// Note: This [Resolver] can send multiple lookup attempts, See also /// Note: This [Resolver] can send multiple lookup attempts, See also
/// [`ResolverOpts`](trust_dns_resolver::config::ResolverOpts) which configures 2 attempts (1 retry) /// [`ResolverOpts`](hickory_resolver::config::ResolverOpts) which configures 2 attempts (1 retry)
/// by default. /// by default.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct DnsResolver(TokioAsyncResolver); pub struct DnsResolver(TokioResolver);
// === impl DnsResolver === // === impl DnsResolver ===
impl DnsResolver { impl DnsResolver {
/// Create a new resolver by wrapping the given [`AsyncResolver`] /// Create a new resolver by wrapping the given [`TokioResolver`].
pub const fn new(resolver: TokioAsyncResolver) -> Self { pub const fn new(resolver: TokioResolver) -> Self {
Self(resolver) Self(resolver)
} }
@ -60,7 +60,7 @@ impl DnsResolver {
/// ///
/// This will use `/etc/resolv.conf` on Unix OSes and the registry on Windows. /// This will use `/etc/resolv.conf` on Unix OSes and the registry on Windows.
pub fn from_system_conf() -> Result<Self, ResolveError> { pub fn from_system_conf() -> Result<Self, ResolveError> {
TokioAsyncResolver::tokio_from_system_conf().map(Self::new) TokioResolver::tokio_from_system_conf().map(Self::new)
} }
} }