diff --git a/Cargo.lock b/Cargo.lock index b66406d2f86..b464a42e610 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -303,7 +303,7 @@ checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" name = "captive_postgres" version = "0.1.0" dependencies = [ - "gel_auth", + "gel-auth", "nix", "openssl", "socket2", @@ -438,7 +438,7 @@ dependencies = [ "statrs", "strum", "test-log", - "thiserror 1.0.69", + "thiserror 2.0.3", "tokio", "tracing", ] @@ -457,9 +457,9 @@ checksum = "47d91586aac6b9f9e32032b8ebf58a8eb03f4b58d3e18ea493b8b2083cb7b88e" [[package]] name = "convert_case" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7" dependencies = [ "unicode-segmentation", ] @@ -577,24 +577,24 @@ dependencies = [ "derive_more", "paste", "pretty_assertions", - "thiserror 1.0.69", + "thiserror 2.0.3", "uuid", ] [[package]] name = "derive_more" -version = "1.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "1.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "convert_case", "proc-macro2", @@ -683,7 +683,7 @@ dependencies = [ "serde_json", "sha2", "snafu", - "thiserror 1.0.69", + "thiserror 2.0.3", "unicode-width", ] @@ -957,6 +957,27 @@ dependencies = [ "slab", ] +[[package]] +name = "gel-auth" +version = "0.1.0" +dependencies = [ + "base64", + "constant_time_eq", + "derive_more", + "hex-literal", + "hmac", + "md5", + "pretty_assertions", + "pyo3", + "rand", + "roaring", + "rstest 0.24.0", + "sha2", + "thiserror 2.0.3", + "tracing", + "unicode-normalization", +] + [[package]] name = "gel-stream" version = "0.1.0" @@ -969,7 +990,6 @@ dependencies = [ "ntest", "openssl", "openssl-sys", - "rstest 0.24.0", "rustls", "rustls-pemfile", "rustls-pki-types", @@ -982,26 +1002,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "gel_auth" -version = "0.1.0" -dependencies = [ - "base64", - "constant_time_eq", - "derive_more", - "hex-literal", - "hmac", - "md5", - "pretty_assertions", - "rand", - "roaring", - "rstest 0.23.0", - "sha2", - "thiserror 2.0.3", - "tracing", - "unicode-normalization", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1065,7 +1065,7 @@ dependencies = [ "num-traits", "pretty_assertions", "pyo3", - "thiserror 1.0.69", + "thiserror 2.0.3", ] [[package]] @@ -1982,8 +1982,8 @@ dependencies = [ "db_proto", "derive_more", "futures", + "gel-auth", "gel-stream", - "gel_auth", "hex-literal", "hexdump", "libc", @@ -1998,9 +1998,8 @@ dependencies = [ "serde", "serde_derive", "test-log", - "thiserror 1.0.69", + "thiserror 2.0.3", "tokio", - "tokio-openssl", "tracing", "tracing-subscriber", "url", @@ -2177,11 +2176,8 @@ dependencies = [ name = "pyo3_util" version = "0.1.0" dependencies = [ - "nix", "pyo3", "scopeguard", - "thiserror 1.0.69", - "tokio", "tracing", "tracing-subscriber", ] @@ -2530,7 +2526,6 @@ dependencies = [ "pgrust", "pyo3", "pyo3_util", - "tokio", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e012e8a583e..51df7775b64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,10 +5,10 @@ members = [ "edb/edgeql-parser/edgeql-parser-python", "edb/graphql-rewrite", "edb/server/_rust_native", - "rust/auth", "rust/captive_postgres", "rust/conn_pool", "rust/db_proto", + "rust/gel-auth", "rust/gel-stream", "rust/pgrust", "rust/http", @@ -22,7 +22,7 @@ tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "time", tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["registry", "env-filter"] } -gel_auth = { path = "rust/auth" } +gel-auth = { path = "rust/gel-auth" } gel-stream = { path = "rust/gel-stream" } db_proto = { path = "rust/db_proto" } captive_postgres = { path = "rust/captive_postgres" } diff --git a/edb/edgeql-parser/Cargo.toml b/edb/edgeql-parser/Cargo.toml index 1a62e836f91..b14498c7ec6 100644 --- a/edb/edgeql-parser/Cargo.toml +++ b/edb/edgeql-parser/Cargo.toml @@ -18,7 +18,7 @@ sha2 = "0.10.2" snafu = "0.8.1" memchr = "2.5.0" serde = { version = "1.0.106", features = ["derive"], optional = true } -thiserror = "1.0.23" +thiserror = "2" unicode-width = "0.1.8" edgeql-parser-derive = { path = "edgeql-parser-derive", optional = true } indexmap = "2.4.0" diff --git a/edb/graphql-rewrite/Cargo.toml b/edb/graphql-rewrite/Cargo.toml index 654031969e1..88e38af7b92 100644 --- a/edb/graphql-rewrite/Cargo.toml +++ b/edb/graphql-rewrite/Cargo.toml @@ -16,7 +16,7 @@ default = ["python_extension"] pyo3 = { workspace = true, optional = true } combine = "3.8" -thiserror = "1.0.11" +thiserror = "2" num-bigint = "0.4.3" num-traits = "0.2.11" edb-graphql-parser = { git="https://github.com/edgedb/graphql-parser" } diff --git a/edb/server/_rust_native/Cargo.toml b/edb/server/_rust_native/Cargo.toml index 63c1c0a4b75..934c06c97d7 100644 --- a/edb/server/_rust_native/Cargo.toml +++ b/edb/server/_rust_native/Cargo.toml @@ -13,7 +13,6 @@ python_extension = ["pyo3/extension-module", "pyo3/serde"] [dependencies] pyo3 = { workspace = true } -tokio.workspace = true pyo3_util.workspace = true conn_pool = { workspace = true, features = [ "python_extension" ] } pgrust = { workspace = true, features = [ "python_extension" ] } diff --git a/rust/captive_postgres/Cargo.toml b/rust/captive_postgres/Cargo.toml index eedbc2aa61d..e90c5cab45b 100644 --- a/rust/captive_postgres/Cargo.toml +++ b/rust/captive_postgres/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" workspace = true [dependencies] -gel_auth.workspace = true +gel-auth.workspace = true openssl = "0.10.70" tempfile = "3" diff --git a/rust/conn_pool/Cargo.toml b/rust/conn_pool/Cargo.toml index 027ed3f130b..256e7f38104 100644 --- a/rust/conn_pool/Cargo.toml +++ b/rust/conn_pool/Cargo.toml @@ -21,7 +21,7 @@ tracing.workspace = true futures = "0" scopeguard = "1" itertools = "0" -thiserror = "1" +thiserror = "2" strum = { version = "0.26", features = ["derive"] } consume_on_drop = "0" smart-default = "0" @@ -35,9 +35,7 @@ rand = { version = "0.8.5", optional = true } statrs = { version = "0.17.1", optional = true } anyhow = { version = "1", optional = true } -[dependencies.derive_more] -version = "1.0.0-beta.6" -features = ["full"] +derive_more = { version = "2", features = ["full"] } [dev-dependencies] tokio = { workspace = true, features = ["test-util"] } diff --git a/rust/conn_pool/src/pool.rs b/rust/conn_pool/src/pool.rs index c8e383dab4d..fc38253fc0f 100644 --- a/rust/conn_pool/src/pool.rs +++ b/rust/conn_pool/src/pool.rs @@ -61,7 +61,7 @@ pub struct PoolHandle { conn: ConsumeOnDrop>, } -impl Debug for PoolHandle { +impl std::fmt::Debug for PoolHandle { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.conn.0.fmt(f) } diff --git a/rust/conn_pool/src/python.rs b/rust/conn_pool/src/python.rs index 159f0c166e6..dcd01f17376 100644 --- a/rust/conn_pool/src/python.rs +++ b/rust/conn_pool/src/python.rs @@ -79,7 +79,7 @@ type PythonConnId = u64; #[derive(Debug, Default, Clone, Copy, Add, AddAssign, PartialEq, Eq, Hash, PartialOrd, Ord)] struct ConnHandleId(u64); -impl From for Box<(dyn derive_more::Error + std::marker::Send + Sync + 'static)> { +impl From for Box<(dyn std::error::Error + std::marker::Send + Sync + 'static)> { fn from(val: ConnHandleId) -> Self { Box::new(ConnError::Underlying(format!("{val:?}"))) } diff --git a/rust/db_proto/Cargo.toml b/rust/db_proto/Cargo.toml index 80d8bca57f0..0f2d332bc6d 100644 --- a/rust/db_proto/Cargo.toml +++ b/rust/db_proto/Cargo.toml @@ -9,9 +9,9 @@ edition = "2021" workspace = true [dependencies] -thiserror = "1" +thiserror = "2" paste = "1" -derive_more = { version = "1", features = ["full"] } +derive_more = { version = "2", features = ["full"] } uuid = "1" [dev-dependencies] diff --git a/rust/auth/Cargo.toml b/rust/gel-auth/Cargo.toml similarity index 71% rename from rust/auth/Cargo.toml rename to rust/gel-auth/Cargo.toml index f4ecf765b12..1f55b85fd4b 100644 --- a/rust/auth/Cargo.toml +++ b/rust/gel-auth/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "gel_auth" +name = "gel-auth" version = "0.1.0" license = "MIT/Apache-2.0" authors = ["MagicStack Inc. "] @@ -8,23 +8,26 @@ edition = "2021" [lints] workspace = true +[features] +python_extension = ["pyo3"] + [dependencies] +pyo3 = { workspace = true, optional = true } tracing.workspace = true - -rand = "0.8.5" md5 = "0.7.0" -sha2 = "0.10.8" -roaring = "0.10.6" constant_time_eq = "0.3" -base64 = "0.22" +derive_more = { version = "2", features = ["debug"] } +rand = "0.8.5" unicode-normalization = "0.1.23" -thiserror = "2" +base64 = "0.22" +roaring = "0.10.6" hmac = "0.12.1" -derive_more = { version = "1", features = ["debug"] } +sha2 = "0.10.8" +thiserror = "2" [dev-dependencies] pretty_assertions = "1" -rstest = "0.23.0" +rstest = "0.24.0" hex-literal = "0.4.1" [lib] diff --git a/rust/auth/README.md b/rust/gel-auth/README.md similarity index 100% rename from rust/auth/README.md rename to rust/gel-auth/README.md diff --git a/rust/auth/src/handshake/mod.rs b/rust/gel-auth/src/handshake/mod.rs similarity index 100% rename from rust/auth/src/handshake/mod.rs rename to rust/gel-auth/src/handshake/mod.rs diff --git a/rust/auth/src/handshake/server_auth.rs b/rust/gel-auth/src/handshake/server_auth.rs similarity index 100% rename from rust/auth/src/handshake/server_auth.rs rename to rust/gel-auth/src/handshake/server_auth.rs diff --git a/rust/auth/src/lib.rs b/rust/gel-auth/src/lib.rs similarity index 98% rename from rust/auth/src/lib.rs rename to rust/gel-auth/src/lib.rs index 4310b15e060..e6d98eac020 100644 --- a/rust/auth/src/lib.rs +++ b/rust/gel-auth/src/lib.rs @@ -1,8 +1,6 @@ pub mod handshake; pub mod md5; pub mod scram; -pub mod stringprep; -mod stringprep_table; use rand::Rng; diff --git a/rust/auth/src/md5.rs b/rust/gel-auth/src/md5.rs similarity index 100% rename from rust/auth/src/md5.rs rename to rust/gel-auth/src/md5.rs diff --git a/rust/auth/src/scram.rs b/rust/gel-auth/src/scram/mod.rs similarity index 99% rename from rust/auth/src/scram.rs rename to rust/gel-auth/src/scram/mod.rs index 8c1e8ace725..0b824de762b 100644 --- a/rust/auth/src/scram.rs +++ b/rust/gel-auth/src/scram/mod.rs @@ -74,7 +74,10 @@ use sha2::{digest::FixedOutput, Digest, Sha256}; use std::borrow::Cow; use std::str::FromStr; -use crate::stringprep::sasl_normalize_password_bytes; +pub mod stringprep; +mod stringprep_table; + +use stringprep::sasl_normalize_password_bytes; const CHANNEL_BINDING_ENCODED: &str = "biws"; const MINIMUM_NONCE_LENGTH: usize = 16; diff --git a/rust/auth/src/stringprep.rs b/rust/gel-auth/src/scram/stringprep.rs similarity index 98% rename from rust/auth/src/stringprep.rs rename to rust/gel-auth/src/scram/stringprep.rs index 89c3bc37d48..8b79a374660 100644 --- a/rust/auth/src/stringprep.rs +++ b/rust/gel-auth/src/scram/stringprep.rs @@ -8,7 +8,7 @@ use unicode_normalization::UnicodeNormalization; /// # Examples /// /// ``` -/// # use gel_auth::stringprep::*; +/// # use gel_auth::scram::stringprep::*; /// assert_eq!(sasl_normalize_password_bytes(b"password").as_ref(), b"password"); /// assert_eq!(sasl_normalize_password_bytes("passw\u{00A0}rd".as_bytes()).as_ref(), b"passw rd"); /// assert_eq!(sasl_normalize_password_bytes("pass\u{200B}word".as_bytes()).as_ref(), b"password"); @@ -35,7 +35,7 @@ pub fn sasl_normalize_password_bytes(s: &[u8]) -> Cow<[u8]> { /// # Examples /// /// ``` -/// # use gel_auth::stringprep::*; +/// # use gel_auth::scram::stringprep::*; /// assert_eq!(sasl_normalize_password("password").as_ref(), "password"); /// assert_eq!(sasl_normalize_password("passw\u{00A0}rd").as_ref(), "passw rd"); /// assert_eq!(sasl_normalize_password("pass\u{200B}word").as_ref(), "password"); diff --git a/rust/auth/src/stringprep_table.rs b/rust/gel-auth/src/scram/stringprep_table.rs similarity index 100% rename from rust/auth/src/stringprep_table.rs rename to rust/gel-auth/src/scram/stringprep_table.rs diff --git a/rust/auth/src/stringprep_table_prep.py b/rust/gel-auth/src/scram/stringprep_table_prep.py similarity index 100% rename from rust/auth/src/stringprep_table_prep.py rename to rust/gel-auth/src/scram/stringprep_table_prep.py diff --git a/rust/gel-stream/Cargo.toml b/rust/gel-stream/Cargo.toml index 56b15d09497..4d44d17f4a4 100644 --- a/rust/gel-stream/Cargo.toml +++ b/rust/gel-stream/Cargo.toml @@ -17,7 +17,7 @@ hickory = ["dep:hickory-resolver"] __manual_tests = [] [dependencies] -derive_more = { version = "1", features = ["full"] } +derive_more = { version = "2", features = ["full"] } thiserror = "2" futures = "0.3" @@ -51,7 +51,6 @@ tokio = { version = "1", features = ["full"] } tempfile = "3" ntest = "0.9.3" rustls-pemfile = "2" -rstest = "0.24.0" [lints] workspace = true diff --git a/rust/gel-stream/src/common/openssl.rs b/rust/gel-stream/src/common/openssl.rs index 40d39587fc6..4111792685d 100644 --- a/rust/gel-stream/src/common/openssl.rs +++ b/rust/gel-stream/src/common/openssl.rs @@ -187,7 +187,7 @@ impl TlsDriver for OpensslDriver { if let (Some(cert), Some(key)) = (cert.as_ref(), key.as_ref()) { let builder = openssl::x509::X509::from_der(cert.as_ref())?; ssl.set_certificate(&builder)?; - let builder = openssl::pkey::PKey::private_key_from_der(&key.secret_der())?; + let builder = openssl::pkey::PKey::private_key_from_der(key.secret_der())?; ssl.set_private_key(&builder)?; } @@ -249,8 +249,8 @@ impl TlsDriver for OpensslDriver { } = params; let mut ssl = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls_server())?; - let cert = openssl::x509::X509::from_der(&server_certificate.cert.as_ref())?; - let key = openssl::pkey::PKey::private_key_from_der(&server_certificate.key.secret_der())?; + let cert = openssl::x509::X509::from_der(server_certificate.cert.as_ref())?; + let key = openssl::pkey::PKey::private_key_from_der(server_certificate.key.secret_der())?; ssl.set_certificate(&cert)?; ssl.set_private_key(&key)?; ssl.set_min_proto_version(min_protocol_version.map(|s| s.into()))?; @@ -290,10 +290,8 @@ impl TlsDriver for OpensslDriver { let mut stream = tokio_openssl::SslStream::new(params, stream)?; let res = Pin::new(&mut stream).do_handshake().await; - if res.is_err() { - if stream.ssl().verify_result() != X509VerifyResult::OK { - return Err(SslError::OpenSslErrorVerify(stream.ssl().verify_result())); - } + if res.is_err() && stream.ssl().verify_result() != X509VerifyResult::OK { + return Err(SslError::OpenSslErrorVerify(stream.ssl().verify_result())); } let alpn = stream @@ -348,14 +346,14 @@ impl TlsDriver for OpensslDriver { } } -fn ssl_select_next_proto<'a, 'b>(server: &'a [u8], client: &'b [u8]) -> Option<&'b [u8]> { +fn ssl_select_next_proto<'b>(server: &[u8], client: &'b [u8]) -> Option<&'b [u8]> { let mut server_packet = server; while !server_packet.is_empty() { - let server_proto_len = *server_packet.get(0)? as usize; + let server_proto_len = *server_packet.first()? as usize; let server_proto = server_packet.get(1..1 + server_proto_len)?; let mut client_packet = client; while !client_packet.is_empty() { - let client_proto_len = *client_packet.get(0)? as usize; + let client_proto_len = *client_packet.first()? as usize; let client_proto = client_packet.get(1..1 + client_proto_len)?; if client_proto == server_proto { return Some(client_proto); diff --git a/rust/pgrust/Cargo.toml b/rust/pgrust/Cargo.toml index 3ee85a69c3c..559b9f24886 100644 --- a/rust/pgrust/Cargo.toml +++ b/rust/pgrust/Cargo.toml @@ -13,17 +13,16 @@ python_extension = ["pyo3/serde"] optimizer = [] [dependencies] -gel_auth.workspace = true +gel-auth.workspace = true +gel-stream = { workspace = true, features = ["client"] } pyo3.workspace = true tokio.workspace = true tracing.workspace = true db_proto.workspace = true -gel-stream = { workspace = true, features = ["client"] } futures = "0" -thiserror = "1" +thiserror = "2" openssl = { version = "0.10.70", features = ["v111"] } -tokio-openssl = "0.6.4" paste = "1" base64 = "0.22" rand = "0" @@ -33,10 +32,7 @@ serde = "1" serde_derive = "1" percent-encoding = "2" bytemuck = { version = "1", features = ["derive"] } - -[dependencies.derive_more] -version = "1.0.0-beta.6" -features = ["full"] +derive_more = { version = "2", features = ["full"] } [dev-dependencies] tracing-subscriber.workspace = true diff --git a/rust/pyo3_util/Cargo.toml b/rust/pyo3_util/Cargo.toml index 50068aa8edd..4f2e029a3f6 100644 --- a/rust/pyo3_util/Cargo.toml +++ b/rust/pyo3_util/Cargo.toml @@ -10,12 +10,9 @@ workspace = true [dependencies] pyo3.workspace = true -tokio.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -nix = { version = "0.29", features = ["fs"] } scopeguard = "1" -thiserror = "1" [lib]