mirror of
https://github.com/rustfs/rustfs.git
synced 2026-11-20 13:19:34 +08:00
chore(deps): upgrade JWT and FTP dependencies (#9419)
Update jsonwebtoken to 12.0.0 and libunftp to 0.25.0, including the JWT key construction API changes required by the new release. Refresh the lockfile through two requested cargo update and cargo upgrade rounds. Co-authored-by: zhi22915 <qiuzgang@gmail.com>
This commit is contained in:
1 parent
d4af2377fe
commit
4182d55d11
8 files changed
+72
-57
No files matched your search
Generated
+43
-27
@@ -255,7 +255,7 @@ version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||
dependencies = [
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -266,7 +266,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1898,9 +1898,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.20.3"
|
||||
version = "3.20.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
|
||||
checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
@@ -1986,7 +1986,7 @@ dependencies = [
|
||||
"maybe-owned",
|
||||
"rustix",
|
||||
"rustix-linux-procfs",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
"winx",
|
||||
]
|
||||
|
||||
@@ -2080,9 +2080,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.11.1"
|
||||
version = "1.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ff2a8126fff0f8c839080d619675a585e61720bb12d2baceae45769fd66f155"
|
||||
checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
@@ -4083,7 +4083,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4397,7 +4397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4865,7 +4865,7 @@ dependencies = [
|
||||
"hmac 0.13.0",
|
||||
"http 1.5.0",
|
||||
"jiff",
|
||||
"jsonwebtoken",
|
||||
"jsonwebtoken 11.1.0",
|
||||
"reqwest",
|
||||
"rustc_version",
|
||||
"rustls",
|
||||
@@ -6027,10 +6027,26 @@ dependencies = [
|
||||
"base64 0.22.1",
|
||||
"getrandom 0.2.17",
|
||||
"js-sys",
|
||||
"pem 3.0.6",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"signature 2.2.0",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jsonwebtoken"
|
||||
version = "12.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f347a975eb5fa8f5c4eadce6c1152c11c326cf32cf839fb64ff12d5cb8f4ce8b"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"base64 0.23.1",
|
||||
"getrandom 0.4.3",
|
||||
"js-sys",
|
||||
"pem 4.0.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"signature 3.0.0",
|
||||
"simple_asn1",
|
||||
"zeroize",
|
||||
]
|
||||
@@ -6281,9 +6297,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libunftp"
|
||||
version = "0.24.0"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94587cfb90dd87b7cced3bff07d32cb56ad1192baa5d688dfaa8728f22d48d"
|
||||
checksum = "96b019a8d208e2672b68fddc84cc9f15c64df3b717b58773d3b2c9dd28729b30"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bitflags 2.13.2",
|
||||
@@ -6700,9 +6716,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.4"
|
||||
version = "1.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"
|
||||
checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||
@@ -6989,7 +7005,7 @@ version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8797,7 +8813,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"socket2",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9821,7 +9837,7 @@ dependencies = [
|
||||
"argon2",
|
||||
"base64-simd",
|
||||
"chacha20poly1305",
|
||||
"jsonwebtoken",
|
||||
"jsonwebtoken 12.0.0",
|
||||
"pbkdf2 0.13.0",
|
||||
"rand 0.10.3",
|
||||
"rsa 0.10.0-rc.18",
|
||||
@@ -10237,7 +10253,7 @@ dependencies = [
|
||||
"hmac 0.13.0",
|
||||
"hotpath",
|
||||
"http 1.5.0",
|
||||
"jsonwebtoken",
|
||||
"jsonwebtoken 12.0.0",
|
||||
"moka",
|
||||
"openidconnect",
|
||||
"pollster",
|
||||
@@ -10679,7 +10695,7 @@ dependencies = [
|
||||
"hotpath",
|
||||
"ipnetwork",
|
||||
"jiff",
|
||||
"jsonwebtoken",
|
||||
"jsonwebtoken 12.0.0",
|
||||
"moka",
|
||||
"pollster",
|
||||
"proptest",
|
||||
@@ -11382,7 +11398,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11464,7 +11480,7 @@ dependencies = [
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -12275,7 +12291,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -12426,7 +12442,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"psm",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -12734,10 +12750,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom 0.3.4",
|
||||
"getrandom 0.4.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -13852,7 +13868,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+2
-2
@@ -231,7 +231,7 @@ blake2 = "0.11.0"
|
||||
chacha20poly1305 = { version = "0.11.0" }
|
||||
crc-fast = "1.10.0"
|
||||
hmac = { version = "0.13.0" }
|
||||
jsonwebtoken = { version = "11.1.0" }
|
||||
jsonwebtoken = { version = "12.0.0" }
|
||||
openidconnect = { default-features = false, version = "4.1.0" }
|
||||
pbkdf2 = "0.13.0"
|
||||
p256 = { version = "0.14.0", features = ["ecdsa", "pkcs8"] }
|
||||
@@ -394,7 +394,7 @@ opentelemetry-stdout = { version = "0.33.1" }
|
||||
pyroscope = { version = "2.1.5" }
|
||||
|
||||
# FTP and SFTP
|
||||
libunftp = { version = "0.24.0" }
|
||||
libunftp = { version = "0.25.0" }
|
||||
unftp-core = "0.1.1"
|
||||
suppaftp = { version = "12.2.1" }
|
||||
rcgen = { version = "0.14.10", default-features = false, features = ["aws_lc_rs", "crypto", "pem"] }
|
||||
|
||||
@@ -18,9 +18,6 @@ use crate::Error;
|
||||
use crate::jwt::Claims;
|
||||
|
||||
pub fn decode(token: &str, token_secret: &[u8]) -> Result<TokenData<Claims>, Error> {
|
||||
Ok(jsonwebtoken::decode(
|
||||
token,
|
||||
&DecodingKey::from_secret(token_secret),
|
||||
&Validation::new(Algorithm::HS512),
|
||||
)?)
|
||||
let key = DecodingKey::from_secret(token_secret)?;
|
||||
Ok(jsonwebtoken::decode(token, &key, &Validation::new(Algorithm::HS512))?)
|
||||
}
|
||||
@@ -18,9 +18,6 @@ use crate::Error;
|
||||
use crate::jwt::Claims;
|
||||
|
||||
pub fn encode(token_secret: &[u8], claims: &Claims) -> Result<String, Error> {
|
||||
Ok(jsonwebtoken::encode(
|
||||
&Header::new(Algorithm::HS512),
|
||||
claims,
|
||||
&EncodingKey::from_secret(token_secret),
|
||||
)?)
|
||||
let key = EncodingKey::from_secret(token_secret)?;
|
||||
Ok(jsonwebtoken::encode(&Header::new(Algorithm::HS512), claims, &key)?)
|
||||
}
|
||||
@@ -190,8 +190,12 @@ fn caller_supplied_tokens_cannot_be_signed_with_the_client_secret() {
|
||||
"iss": config.config_url, "sub": "repo:example/project:ref:refs/heads/main",
|
||||
"aud": [config.client_id, "additional-audience"], "iat": now, "exp": now + 300,
|
||||
});
|
||||
let signed =
|
||||
jsonwebtoken::encode(&Header::new(Algorithm::HS256), &payload, &EncodingKey::from_secret(secret.as_bytes())).unwrap();
|
||||
let signed = jsonwebtoken::encode(
|
||||
&Header::new(Algorithm::HS256),
|
||||
&payload,
|
||||
&EncodingKey::from_secret(secret.as_bytes()).expect("construct test JWT key"),
|
||||
)
|
||||
.unwrap();
|
||||
let token: CoreIdToken = signed.parse().unwrap();
|
||||
for workload in [false, true] {
|
||||
for (algorithms, accepted) in [
|
||||
@@ -236,8 +240,12 @@ fn configured_verifier_rejects_malformed_hmac_signature_lengths() {
|
||||
(Algorithm::HS384, "HS384", 48),
|
||||
(Algorithm::HS512, "HS512", 64),
|
||||
] {
|
||||
let signed = jsonwebtoken::encode(&Header::new(algorithm), &payload, &EncodingKey::from_secret(secret.as_bytes()))
|
||||
.expect("sign a valid HMAC control token");
|
||||
let signed = jsonwebtoken::encode(
|
||||
&Header::new(algorithm),
|
||||
&payload,
|
||||
&EncodingKey::from_secret(secret.as_bytes()).expect("construct test JWT key"),
|
||||
)
|
||||
.expect("sign a valid HMAC control token");
|
||||
let valid: CoreIdToken = signed.parse().expect("parse valid HMAC token");
|
||||
let (signing_input, signature) = signed.rsplit_once('.').expect("JWT signature segment");
|
||||
assert_eq!(
|
||||
|
||||
@@ -18,18 +18,16 @@ use std::collections::HashSet;
|
||||
|
||||
pub fn generate_jwt<T: Serialize>(claims: &T, secret: &str) -> std::result::Result<String, jsonwebtoken::errors::Error> {
|
||||
let header = Header::new(Algorithm::HS512);
|
||||
jsonwebtoken::encode(&header, &claims, &EncodingKey::from_secret(secret.as_bytes()))
|
||||
let key = EncodingKey::from_secret(secret.as_bytes())?;
|
||||
jsonwebtoken::encode(&header, &claims, &key)
|
||||
}
|
||||
|
||||
pub fn extract_claims<T: DeserializeOwned + Clone>(
|
||||
token: &str,
|
||||
secret: &str,
|
||||
) -> std::result::Result<jsonwebtoken::TokenData<T>, jsonwebtoken::errors::Error> {
|
||||
jsonwebtoken::decode::<T>(
|
||||
token,
|
||||
&DecodingKey::from_secret(secret.as_bytes()),
|
||||
&jsonwebtoken::Validation::new(Algorithm::HS512),
|
||||
)
|
||||
let key = DecodingKey::from_secret(secret.as_bytes())?;
|
||||
jsonwebtoken::decode::<T>(token, &key, &jsonwebtoken::Validation::new(Algorithm::HS512))
|
||||
}
|
||||
|
||||
pub fn extract_claims_allow_missing_exp<T: DeserializeOwned + Clone>(
|
||||
@@ -39,7 +37,8 @@ pub fn extract_claims_allow_missing_exp<T: DeserializeOwned + Clone>(
|
||||
let mut validation = jsonwebtoken::Validation::new(Algorithm::HS512);
|
||||
validation.required_spec_claims = HashSet::new();
|
||||
|
||||
jsonwebtoken::decode::<T>(token, &DecodingKey::from_secret(secret.as_bytes()), &validation)
|
||||
let key = DecodingKey::from_secret(secret.as_bytes())?;
|
||||
jsonwebtoken::decode::<T>(token, &key, &validation)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -217,7 +217,7 @@ mod tests {
|
||||
|
||||
// Create an invalid JWT to generate a JWT error
|
||||
let invalid_token = "invalid.jwt.token";
|
||||
let key = DecodingKey::from_secret(b"secret");
|
||||
let key = DecodingKey::from_secret(b"secret").expect("construct test JWT key");
|
||||
let validation = Validation::new(Algorithm::HS256);
|
||||
|
||||
let jwt_result = decode::<Claims>(invalid_token, &key, &validation);
|
||||
|
||||
@@ -17,18 +17,16 @@ use serde::{Serialize, de::DeserializeOwned};
|
||||
|
||||
pub fn generate_jwt<T: Serialize>(claims: &T, secret: &str) -> std::result::Result<String, jsonwebtoken::errors::Error> {
|
||||
let header = Header::new(Algorithm::HS512);
|
||||
jsonwebtoken::encode(&header, &claims, &EncodingKey::from_secret(secret.as_bytes()))
|
||||
let key = EncodingKey::from_secret(secret.as_bytes())?;
|
||||
jsonwebtoken::encode(&header, &claims, &key)
|
||||
}
|
||||
|
||||
pub fn extract_claims<T: DeserializeOwned + Clone>(
|
||||
token: &str,
|
||||
secret: &str,
|
||||
) -> std::result::Result<jsonwebtoken::TokenData<T>, jsonwebtoken::errors::Error> {
|
||||
jsonwebtoken::decode::<T>(
|
||||
token,
|
||||
&DecodingKey::from_secret(secret.as_bytes()),
|
||||
&jsonwebtoken::Validation::new(Algorithm::HS512),
|
||||
)
|
||||
let key = DecodingKey::from_secret(secret.as_bytes())?;
|
||||
jsonwebtoken::decode::<T>(token, &key, &jsonwebtoken::Validation::new(Algorithm::HS512))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user