mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 23:47:28 +00:00
fix(protocols): use constant-time secret comparison in FTPS and WebDAV auth (#4403)
The FTPS and WebDAV authentication handlers compared the client-supplied secret key against the stored secret with `String::eq`, which short-circuits on the first differing byte. A network attacker who knows (or enumerates) a valid access key can recover the secret key byte-by-byte via response-timing analysis; neither path is rate limited. Switch both to a constant-time comparison using `subtle::ConstantTimeEq`, the same primitive the SFTP handler and `rustfs/src/auth.rs::constant_time_eq` already use. `subtle` is added to the `ftps` and `webdav` feature dependency sets (it was previously gated on `sftp` only). Addresses GHSA-3p3x-734c-h5vx.
This commit is contained in:
@@ -27,7 +27,7 @@ categories = ["network-programming", "filesystem"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
ftps = ["dep:libunftp", "dep:unftp-core", "dep:rustls", "dep:rustfs-tls-runtime"]
|
||||
ftps = ["dep:libunftp", "dep:unftp-core", "dep:rustls", "dep:rustfs-tls-runtime", "dep:subtle"]
|
||||
swift = [
|
||||
"dep:rustfs-keystone",
|
||||
"dep:rustfs-ecstore",
|
||||
@@ -53,7 +53,7 @@ swift = [
|
||||
"dep:base64",
|
||||
"dep:async-compression",
|
||||
]
|
||||
webdav = ["dep:dav-server", "dep:hyper", "dep:hyper-util", "dep:http-body-util", "dep:tokio-rustls", "dep:base64", "dep:rustls", "dep:percent-encoding", "dep:rustfs-tls-runtime"]
|
||||
webdav = ["dep:dav-server", "dep:hyper", "dep:hyper-util", "dep:http-body-util", "dep:tokio-rustls", "dep:base64", "dep:rustls", "dep:percent-encoding", "dep:rustfs-tls-runtime", "dep:subtle"]
|
||||
sftp = ["dep:russh", "dep:russh-sftp", "dep:uuid", "dep:subtle", "dep:tokio-util", "dep:socket2"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
Reference in New Issue
Block a user