diff --git a/Cargo.lock b/Cargo.lock index 79906bb607..74d66a4956 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom", + "getrandom 0.2.15", "once_cell", "version_check", ] @@ -412,10 +412,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ "futures-core", - "getrandom", + "getrandom 0.2.15", "instant", "pin-project-lite", - "rand", + "rand 0.8.5", "tokio", ] @@ -1519,7 +1519,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] @@ -2194,7 +2206,7 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -2205,7 +2217,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] @@ -2314,7 +2326,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.5", "smallvec", "zeroize", ] @@ -2478,7 +2490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -2489,7 +2501,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -2764,6 +2776,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "radium" version = "0.7.0" @@ -2777,8 +2795,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -2788,7 +2816,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -2797,7 +2835,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", ] [[package]] @@ -2806,7 +2853,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -2905,7 +2952,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", "spin", "untrusted", @@ -2954,7 +3001,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature", "spki", "subtle", @@ -2971,7 +3018,7 @@ dependencies = [ "borsh", "bytes", "num-traits", - "rand", + "rand 0.8.5", "rkyv", "serde", "serde_json", @@ -3320,7 +3367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -3389,7 +3436,7 @@ dependencies = [ "hex", "libsqlite3-sys", "paste", - "rand", + "rand 0.8.5", "rand_xoshiro", "serde", "serde_json", @@ -3497,7 +3544,7 @@ dependencies = [ "argon2 0.4.1", "axum", "dotenvy", - "rand", + "rand 0.8.5", "regex", "serde", "serde_json", @@ -3574,7 +3621,7 @@ version = "0.9.0-alpha.1" dependencies = [ "color-eyre", "dotenvy", - "rand", + "rand 0.8.5", "rust_decimal", "sqlx", "sqlx-example-postgres-multi-database-accounts", @@ -3589,7 +3636,7 @@ version = "0.1.0" dependencies = [ "argon2 0.5.3", "password-hash 0.5.0", - "rand", + "rand 0.8.5", "serde", "sqlx", "thiserror 1.0.69", @@ -3615,7 +3662,7 @@ version = "0.9.0-alpha.1" dependencies = [ "color-eyre", "dotenvy", - "rand", + "rand 0.8.5", "rust_decimal", "sqlx", "sqlx-example-postgres-multi-tenant-accounts", @@ -3630,7 +3677,7 @@ version = "0.1.0" dependencies = [ "argon2 0.5.3", "password-hash 0.5.0", - "rand", + "rand 0.8.5", "serde", "sqlx", "thiserror 1.0.69", @@ -3785,7 +3832,7 @@ dependencies = [ "md-5", "memchr", "percent-encoding", - "rand", + "rand 0.8.5", "rsa", "rust_decimal", "serde", @@ -3831,7 +3878,7 @@ dependencies = [ "md-5", "memchr", "num-bigint", - "rand", + "rand 0.9.2", "rust_decimal", "serde", "serde_json", @@ -4088,7 +4135,7 @@ checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", - "getrandom", + "getrandom 0.2.15", "once_cell", "rustix 0.38.43", "windows-sys 0.59.0", @@ -4687,6 +4734,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasite" version = "0.1.0" @@ -4998,6 +5054,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.7.0", +] + [[package]] name = "write16" version = "1.0.0" diff --git a/sqlx-postgres/Cargo.toml b/sqlx-postgres/Cargo.toml index a70fb37d72..baf76d07ec 100644 --- a/sqlx-postgres/Cargo.toml +++ b/sqlx-postgres/Cargo.toml @@ -37,7 +37,7 @@ crc = "3.0.0" hkdf = "0.12.0" hmac = { version = "0.12.0", default-features = false, features = ["reset"]} md-5 = { version = "0.10.0", default-features = false } -rand = { version = "0.8.4", default-features = false, features = ["std", "std_rng"] } +rand = { version = "0.9.0", default-features = false, features = ["std", "std_rng", "thread_rng"] } sha2 = { version = "0.10.0", default-features = false } # Type Integrations (versions inherited from `[workspace.dependencies]`) diff --git a/sqlx-postgres/src/connection/sasl.rs b/sqlx-postgres/src/connection/sasl.rs index 729cc1fcc5..6786a816bc 100644 --- a/sqlx-postgres/src/connection/sasl.rs +++ b/sqlx-postgres/src/connection/sasl.rs @@ -161,8 +161,8 @@ pub(crate) async fn authenticate( // nonce is a sequence of random printable bytes fn gen_nonce() -> String { - let mut rng = rand::thread_rng(); - let count = rng.gen_range(64..128); + let mut rng = rand::rng(); + let count = rng.random_range(64..128); // printable = %x21-2B / %x2D-7E // ;; Printable ASCII except ",". @@ -170,10 +170,10 @@ fn gen_nonce() -> String { // ;; a valid "value". let nonce: String = std::iter::repeat(()) .map(|()| { - let mut c = rng.gen_range(0x21u8..0x7F); + let mut c = rng.random_range(0x21u8..0x7F); while c == 0x2C { - c = rng.gen_range(0x21u8..0x7F); + c = rng.random_range(0x21u8..0x7F); } c @@ -182,7 +182,7 @@ fn gen_nonce() -> String { .map(|c| c as char) .collect(); - rng.gen_range(32..128); + rng.random_range(32..128); format!("{NONCE_ATTR}={nonce}") } @@ -210,9 +210,9 @@ fn hi<'a>(s: &'a str, salt: &'a [u8], iter_count: u32) -> Result<[u8; 32], Error fn bench_sasl_hi(b: &mut test::Bencher) { use test::black_box; - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let nonce: Vec = std::iter::repeat(()) - .map(|()| rng.sample(rand::distributions::Alphanumeric)) + .map(|()| rng.sample(rand::distr::Alphanumeric)) .take(64) .collect(); b.iter(|| {