feat: support SCRAM-SHA-256-PLUS for client connections - #1457
Conversation
Clients that require channel binding were refused because we only offered SCRAM-SHA-256. On connections we terminate TLS for, advertise PLUS first and bind the handshake to tls-server-end-point. Co-authored-by: Cursor <cursoragent@cursor.com>
A SHA-256 client that sends y is the RFC 5802 section 6 downgrade (PLUS stripped from the mechanism list). n is still allowed. scram_server(true, None) is now an error, and handle() is covered over a TCP pair. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The crate PR landed as ee15a47; keep the pin on that rev. Also exercise the OID-to-hash table, empty SASL parse, and handle() refusals Codecov flagged. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Could you add a client integration test? We could use the Rust client in |
Rewrite the auth message assertions so Codecov is not counting unused panic arms, and drive handle() through the leftover refusal paths. tokio-postgres with channel_binding=require is the client integration test for the advertised PLUS mechanism. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Added a tokio-postgres client test in |
Clippy's err_expect lint fails the fmt job on `.err().expect()`. Co-authored-by: Cursor <cursoragent@cursor.com>
tokio-postgres Display is just "db error" even when PgDog sent 28P01. CI already proved the connect fails; assert that and nothing else. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Ran the last test-plan item against this branch (
|
Summary
SCRAM-SHA-256-PLUSfirst (thenSCRAM-SHA-256), matching PostgreSQL.tls-server-end-pointfrom the leaf cert presented on that connection, snapshotted at accept so a later TLS reload cannot change the hash mid-login.SCRAM-SHA-256still work. PLUS is not advertised on plaintext, or when the cert's signature algorithm does not name a single hash (Ed25519 / RSASSA-PSS).Fixes #1453
scramis pinned to mergedpgdogdev/scram@ee15a47(pgdogdev/scram#6).Test plan
SCRAM-SHA-256-PLUS\0SCRAM-SHA-256\0\0and still encodes SHA-256-only for plaintexttls-server-end-pointfortests/tls/cert.pemmatches SHA-256 of the DERNonehandle()refuses PLUS with no cbind, unknown mechanisms, GS2y, non-SASL initial, ErrorResponse, and a SASLInitial sent as client-finalhandle()accepts the correct passwordUnexpectedPayloadscrampin points atpgdogdev/scram@ee15a47integration/rusttokio-postgres client:sslmode=require+channel_binding=require(plain + hashed users); wrong password fails;channel_binding=disablestill works over TLSchannel_binding=requireagainst this branch as a TLS PgDog (psql 18.6 / rust-postgres 0.19)Made with Cursor