Skip to content

Commit

Permalink
Migrate auth -> gel-auth (#8313)
Browse files Browse the repository at this point in the history
Minor housekeeping -- trying to rename internal crates to `gel-*`.
Extracted from #8299.

Some internal modules moved in `gel-auth` in anticipation of adding some
more auth methods.

As part of the work, trimmed some deps using `cargo-shear`.
  • Loading branch information
mmastrac authored and deepbuzin committed Feb 18, 2025
1 parent 581fd8f commit 2e677f8
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 90 deletions.
73 changes: 34 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion edb/edgeql-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion edb/graphql-rewrite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
1 change: 0 additions & 1 deletion edb/server/_rust_native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ] }
Expand Down
2 changes: 1 addition & 1 deletion rust/captive_postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
workspace = true

[dependencies]
gel_auth.workspace = true
gel-auth.workspace = true

openssl = "0.10.70"
tempfile = "3"
Expand Down
6 changes: 2 additions & 4 deletions rust/conn_pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion rust/conn_pool/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub struct PoolHandle<C: Connector> {
conn: ConsumeOnDrop<HandleAndPool<C>>,
}

impl<C: Connector> Debug for PoolHandle<C> {
impl<C: Connector> std::fmt::Debug for PoolHandle<C> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.conn.0.fmt(f)
}
Expand Down
2 changes: 1 addition & 1 deletion rust/conn_pool/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type PythonConnId = u64;
#[derive(Debug, Default, Clone, Copy, Add, AddAssign, PartialEq, Eq, Hash, PartialOrd, Ord)]
struct ConnHandleId(u64);

impl From<ConnHandleId> for Box<(dyn derive_more::Error + std::marker::Send + Sync + 'static)> {
impl From<ConnHandleId> for Box<(dyn std::error::Error + std::marker::Send + Sync + 'static)> {
fn from(val: ConnHandleId) -> Self {
Box::new(ConnError::Underlying(format!("{val:?}")))
}
Expand Down
4 changes: 2 additions & 2 deletions rust/db_proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
21 changes: 12 additions & 9 deletions rust/auth/Cargo.toml → rust/gel-auth/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "gel_auth"
name = "gel-auth"
version = "0.1.0"
license = "MIT/Apache-2.0"
authors = ["MagicStack Inc. <[email protected]>"]
Expand All @@ -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]
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions rust/auth/src/lib.rs → rust/gel-auth/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pub mod handshake;
pub mod md5;
pub mod scram;
pub mod stringprep;
mod stringprep_table;

use rand::Rng;

Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion rust/auth/src/scram.rs → rust/gel-auth/src/scram/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions rust/gel-stream/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 2e677f8

Please sign in to comment.