Zeroize SQL auth password buffers - #411
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR adds the zeroize crate and applies in-memory zeroization to SQL Server authentication and login: passwords are stored as Zeroizing, a new into_credentials() replaces accessors, LoginMessage gains encode_to_vec() returning Zeroizing<Vec>, and Connection adds send_sensitive_login() to transmit and zeroize frames. Changes
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes with custom instructions.Set the |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b5f34033-416c-4063-a002-f644feb0373d
📒 Files selected for processing (4)
Cargo.tomlsrc/client/auth.rssrc/client/connection.rssrc/tds/codec/login.rs
|
Any update on this? |
prisma#390, prisma#411) - header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use) - connection.rs: drop needless reborrow in the zeroizing send path - row.rs: elide lifetime on get_column_data - rustfmt negative-numeric formatting from prisma#390
Mirrors prisma/tiberius#411. Reduces how long a plaintext SQL Server auth password lives in process memory (defense against memory-scraping / core-dump / heap-inspection): a real, if modest, security hardening for anyone using AuthMethod::sql_server (as opposed to Windows/AAD auth). - SqlServerAuth now stores the password as Zeroizing<String> and exposes it only via a consuming into_credentials(), replacing the &str accessors. - LoginMessage::encode gains a sibling encode_to_vec() returning Zeroizing<Vec<u8>>, used by the new Connection::send_sensitive_login, which zeroizes each on-wire packet frame and the corresponding slice of the source payload immediately after writing it, rather than leaving the whole encoded LOGIN7 packet (which embeds the password) sitting in a buffer for the normal send() path to flush on its own schedule. - The federated-auth token buffer in LoginMessage::encode_to_vec is zeroized after use too, for the same reason. Adds zeroize 1.8.2 (RustCrypto-maintained, no unsafe beyond volatile writes, already low-risk and widely used) as a new dependency. Verified: cargo check across all 6 CI feature combinations, cargo clippy --all-targets, cargo fmt --check, cargo test --lib (152 passing, including a new test asserting the password is consumable and zeroizable), cargo +1.96 check (pinned MSRV), and cargo audit (clean) all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0156Di1tRRLsJK8ctU1AmAJr
Zeroize SQL Server auth password buffers so the password only lives in crate-owned memory during login, and scrub transient login packet buffers immediately after use.
Summary by CodeRabbit
Security Improvements
New Features