security hardening: timing-safe auth, file permissions, password file#71
Merged
security hardening: timing-safe auth, file permissions, password file#71
Conversation
replace `==` with `subtle::ConstantTimeEq` in all three AUTH handlers to prevent timing side-channel attacks. adds the `subtle` crate as a workspace dependency.
AOF and snapshot files may contain sensitive data. set file mode to owner-only read/write (0600) using OpenOptionsExt on unix platforms. non-unix platforms retain default behavior.
adds --requirepass-file as an alternative to --requirepass, avoiding password exposure in /proc/cmdline. the file is read at startup and trimmed of trailing whitespace. errors if both flags are set or if the file is empty/unreadable.
kacy
added a commit
that referenced
this pull request
Feb 11, 2026
…#71) * fix: use constant-time comparison for password authentication replace `==` with `subtle::ConstantTimeEq` in all three AUTH handlers to prevent timing side-channel attacks. adds the `subtle` crate as a workspace dependency. * fix: restrict persistence file permissions to 0600 on unix AOF and snapshot files may contain sensitive data. set file mode to owner-only read/write (0600) using OpenOptionsExt on unix platforms. non-unix platforms retain default behavior. * feat: add --requirepass-file flag for file-based password adds --requirepass-file as an alternative to --requirepass, avoiding password exposure in /proc/cmdline. the file is read at startup and trimmed of trailing whitespace. errors if both flags are set or if the file is empty/unreadable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
three targeted security fixes identified during audit:
connection_common.rs,connection.rs,concurrent_handler.rs) now usesubtle::ConstantTimeEqinstead of==, preventing timing side-channel attacks on password guessing0600(owner-only) on unix viaOpenOptionsExt, preventing other users on the system from reading potentially sensitive cached data--requirepass-fileflag — alternative to--requirepassthat reads the password from a file at startup, avoiding exposure in/proc/cmdlineand shell history. mutually exclusive with--requirepass, errors on empty or unreadable fileswhat was tested
cargo clippy --workspace -- -D warnings— cleancargo test --workspace— all tests pass, no regressions0600--requirepass-fileworks with AUTH, rejects empty files, errors when both flags setdesign considerations
subtlecrate is the standard for constant-time operations in rust (used by ring, rustls, etc.)#[cfg(unix)]gating so windows builds aren't affectedtrim_end()(nottrim()) to allow leading whitespace in passwords, matching common secret-file conventions