Deps: argon2 0.6.0 and sha2 0.11.1, off digest 0.11 RCs and block-buffer 0.11.0-rc.5

6228e32 · Gabe Morell · 2026-10-27 19:41

5 files +65 -43
Message
{commit_body(@commit)}

Files changed

modified Cargo.lock
+58 −33
@@ -204,13 +204,13 @@ dependencies = [
204 204
205 205 [[package]]
206 206 name = "argon2"
207 −version = "0.6.0-rc.1"
207 +version = "0.6.0"
208 208 source = "registry+https://github.com/rust-lang/crates.io-index"
209 −checksum = "d911686206fdd816a61ed5226535997149b0fc7726e37fee46f407c9ff82ed87"
209 +checksum = "134c52ddac6d63c576bef8168db10c83c49c26444ecbc68060fef078925a901c"
210 210 dependencies = [
211 211 "base64ct",
212 212 "blake2",
213 − "cpufeatures 0.2.17",
213 + "cpufeatures 0.3.1",
214 214 "password-hash",
215 215 ]
216 216
@@ -620,11 +620,11 @@ dependencies = [
620 620
621 621 [[package]]
622 622 name = "blake2"
623 −version = "0.11.0-rc.2"
623 +version = "0.11.0"
624 624 source = "registry+https://github.com/rust-lang/crates.io-index"
625 −checksum = "1edac47499deef695d9431bf241c75ea29f4cf3dcb78d39e19b31515e4ad3b08"
625 +checksum = "5b5d4d889834ee8ecfc0f8426ad30faf7cdcb10f741a8e6d7224d95325479f6f"
626 626 dependencies = [
627 − "digest 0.11.0-rc.2",
627 + "digest 0.11.3",
628 628 ]
629 629
630 630 [[package]]
@@ -638,9 +638,9 @@ dependencies = [
638 638
639 639 [[package]]
640 640 name = "block-buffer"
641 −version = "0.11.0-rc.5"
641 +version = "0.12.1"
642 642 source = "registry+https://github.com/rust-lang/crates.io-index"
643 −checksum = "e9ef36a6fcdb072aa548f3da057640ec10859eb4e91ddf526ee648d50c76a949"
643 +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
644 644 dependencies = [
645 645 "hybrid-array",
646 646 ]
@@ -854,6 +854,12 @@ version = "0.7.5"
854 854 source = "registry+https://github.com/rust-lang/crates.io-index"
855 855 checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
856 856
857 +[[package]]
858 +name = "cmov"
859 +version = "0.5.4"
860 +source = "registry+https://github.com/rust-lang/crates.io-index"
861 +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
862 +
857 863 [[package]]
858 864 name = "cms"
859 865 version = "0.2.3"
@@ -1050,13 +1056,22 @@ dependencies = [
1050 1056
1051 1057 [[package]]
1052 1058 name = "crypto-common"
1053 −version = "0.2.0-rc.4"
1059 +version = "0.2.2"
1054 1060 source = "registry+https://github.com/rust-lang/crates.io-index"
1055 −checksum = "6a8235645834fbc6832939736ce2f2d08192652269e11010a6240f61b908a1c6"
1061 +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
1056 1062 dependencies = [
1057 1063 "hybrid-array",
1058 1064 ]
1059 1065
1066 +[[package]]
1067 +name = "ctutils"
1068 +version = "0.4.6"
1069 +source = "registry+https://github.com/rust-lang/crates.io-index"
1070 +checksum = "fe3e9d21d39e6f39ff46e03d5b621424f88ee23d8a1672c6bfc9ccc7f2da4f6a"
1071 +dependencies = [
1072 + "cmov",
1073 +]
1074 +
1060 1075 [[package]]
1061 1076 name = "darling"
1062 1077 version = "0.20.11"
@@ -1168,14 +1183,14 @@ dependencies = [
1168 1183
1169 1184 [[package]]
1170 1185 name = "digest"
1171 −version = "0.11.0-rc.2"
1186 +version = "0.11.3"
1172 1187 source = "registry+https://github.com/rust-lang/crates.io-index"
1173 −checksum = "6749b668519cd7149ee3d11286a442a8a8bdc3a9d529605f579777bfccc5a4bc"
1188 +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
1174 1189 dependencies = [
1175 − "block-buffer 0.11.0-rc.5",
1190 + "block-buffer 0.12.1",
1176 1191 "const-oid 0.10.1",
1177 − "crypto-common 0.2.0-rc.4",
1178 − "subtle",
1192 + "crypto-common 0.2.2",
1193 + "ctutils",
1179 1194 ]
1180 1195
1181 1196 [[package]]
@@ -1222,7 +1237,7 @@ dependencies = [
1222 1237 "sea-orm",
1223 1238 "serde",
1224 1239 "serde_json",
1225 − "sha2 0.11.0-rc.2",
1240 + "sha2 0.11.1",
1226 1241 "thiserror",
1227 1242 "tokio",
1228 1243 "tokio-util",
@@ -1290,7 +1305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1290 1305 checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
1291 1306 dependencies = [
1292 1307 "libc",
1293 − "windows-sys 0.52.0",
1308 + "windows-sys 0.61.1",
1294 1309 ]
1295 1310
1296 1311 [[package]]
@@ -1829,9 +1844,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
1829 1844
1830 1845 [[package]]
1831 1846 name = "hybrid-array"
1832 −version = "0.4.4"
1847 +version = "0.4.15"
1833 1848 source = "registry+https://github.com/rust-lang/crates.io-index"
1834 −checksum = "2bad028b20a90afcdb5e28a53392562f1db2bdfa238aa1a978b911461bfffb92"
1849 +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
1835 1850 dependencies = [
1836 1851 "typenum",
1837 1852 ]
@@ -2906,13 +2921,12 @@ dependencies = [
2906 2921
2907 2922 [[package]]
2908 2923 name = "password-hash"
2909 −version = "0.6.0-rc.1"
2924 +version = "0.6.1"
2910 2925 source = "registry+https://github.com/rust-lang/crates.io-index"
2911 −checksum = "8ee14c44aa1c04c22c4d4532c4fa2cdd5b6d31c2514a5898530d889fc2fc2737"
2926 +checksum = "aab41826031698d6ffcd9cff78ef56ef998e39dc7e5067cdfebe373842d4723b"
2912 2927 dependencies = [
2913 − "base64ct",
2914 − "rand_core 0.9.3",
2915 − "subtle",
2928 + "getrandom 0.4.3",
2929 + "phc",
2916 2930 ]
2917 2931
2918 2932 [[package]]
@@ -2961,6 +2975,17 @@ dependencies = [
2961 2975 "serde",
2962 2976 ]
2963 2977
2978 +[[package]]
2979 +name = "phc"
2980 +version = "0.6.1"
2981 +source = "registry+https://github.com/rust-lang/crates.io-index"
2982 +checksum = "44dc769b75f93afdddd8c7fa12d685292ddeff1e66f7f0f3a234cf1818afe892"
2983 +dependencies = [
2984 + "base64ct",
2985 + "ctutils",
2986 + "getrandom 0.4.3",
2987 +]
2988 +
2964 2989 [[package]]
2965 2990 name = "pin-project-lite"
2966 2991 version = "0.2.16"
@@ -3755,7 +3780,7 @@ dependencies = [
3755 3780 "errno",
3756 3781 "libc",
3757 3782 "linux-raw-sys",
3758 − "windows-sys 0.52.0",
3783 + "windows-sys 0.59.0",
3759 3784 ]
3760 3785
3761 3786 [[package]]
@@ -4163,13 +4188,13 @@ dependencies = [
4163 4188
4164 4189 [[package]]
4165 4190 name = "sha2"
4166 −version = "0.11.0-rc.2"
4191 +version = "0.11.1"
4167 4192 source = "registry+https://github.com/rust-lang/crates.io-index"
4168 −checksum = "d1e3878ab0f98e35b2df35fe53201d088299b41a6bb63e3e34dada2ac4abd924"
4193 +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
4169 4194 dependencies = [
4170 4195 "cfg-if",
4171 − "cpufeatures 0.2.17",
4172 − "digest 0.11.0-rc.2",
4196 + "cpufeatures 0.3.1",
4197 + "digest 0.11.3",
4173 4198 ]
4174 4199
4175 4200 [[package]]
@@ -4272,7 +4297,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
4272 4297 checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
4273 4298 dependencies = [
4274 4299 "libc",
4275 − "windows-sys 0.60.2",
4300 + "windows-sys 0.61.1",
4276 4301 ]
4277 4302
4278 4303 [[package]]
@@ -4954,9 +4979,9 @@ checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
4954 4979
4955 4980 [[package]]
4956 4981 name = "typenum"
4957 −version = "1.18.0"
4982 +version = "1.20.1"
4958 4983 source = "registry+https://github.com/rust-lang/crates.io-index"
4959 −checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
4984 +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
4960 4985
4961 4986 [[package]]
4962 4987 name = "unicase"
@@ -5266,7 +5291,7 @@ version = "0.1.11"
5266 5291 source = "registry+https://github.com/rust-lang/crates.io-index"
5267 5292 checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
5268 5293 dependencies = [
5269 − "windows-sys 0.48.0",
5294 + "windows-sys 0.61.1",
5270 5295 ]
5271 5296
5272 5297 [[package]]
modified Cargo.toml
+2 −2
@@ -38,8 +38,8 @@ sea-orm = { workspace = true }
38 38 chrono = { workspace = true }
39 39 uuid = { workspace = true }
40 40 serde = { workspace = true }
41 −argon2 = { version = "0.6.0-rc.1", features = ["std"] }
42 −sha2 = "0.11.0-rc.2"
41 +argon2 = "0.6.0"
42 +sha2 = "0.11.1"
43 43 hex = "0.4.3"
44 44 migration = { path = "./migration" }
45 45
modified src/auth/password.rs
+5 −8
@@ -1,17 +1,14 @@
1 1 use argon2::{Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
2 −use argon2::password_hash::SaltString;
3 −use argon2::password_hash::rand_core::OsRng;
4 2 use anyhow::{Context, Result};
5 3
6 4 /// Hash a password using Argon2
7 5 pub fn hash_password(password: &str) -> Result<String> {
8 − // Fresh random salt per hash. The salt is embedded in the returned PHC
9 − // string, so `verify_password` keeps working against older hashes.
10 − let salt = SaltString::try_from_rng(&mut OsRng)
11 − .map_err(|e| anyhow::anyhow!("Failed to generate salt: {}", e))?;
6 + // Fresh random salt per hash (argon2's getrandom feature generates it).
7 + // The salt is embedded in the returned PHC string, so `verify_password`
8 + // keeps working against older hashes.
12 9 let argon2 = Argon2::default();
13 10 let password_hash = argon2
14 − .hash_password(password.as_bytes(), &salt)
11 + .hash_password(password.as_bytes())
15 12 .context("Failed to hash password")?;
16 13 Ok(password_hash.to_string())
17 14 }
@@ -23,7 +20,7 @@ pub fn verify_password(password: &str, hash: &str) -> Result<bool> {
23 20
24 21 match argon2.verify_password(password.as_bytes(), &parsed_hash) {
25 22 Ok(()) => Ok(true),
26 − Err(argon2::password_hash::Error::Password) => Ok(false),
23 + Err(argon2::password_hash::Error::PasswordInvalid) => Ok(false),
27 24 Err(e) => Err(anyhow::anyhow!("Password verification error: {}", e)),
28 25 }
29 26 }

Parents: b692f89