Skip to content

feat: include channel-binding data in SCRAM proofs - #6

Merged
levkk merged 2 commits into
pgdogdev:masterfrom
abnegate:feat/scram-sha-256-plus
Aug 31, 2026
Merged

feat: include channel-binding data in SCRAM proofs#6
levkk merged 2 commits into
pgdogdev:masterfrom
abnegate:feat/scram-sha-256-plus

Conversation

@abnegate

Copy link
Copy Markdown

Summary

  • AuthMessage c= is now base64(gs2-header || cbind-data) when the GS2 flag is p, which is what libpq and rust-postgres sign over for SCRAM-SHA-256-PLUS.
  • The existing server accepted a PLUS client-first but verified the proof as if c= were only the GS2 header, so a real handshake would fail.
  • Client PLUS support (ScramClient::new_with_channel_binding) so the handshake can be tested end-to-end, including the stored-key path.
  • Reject the RFC 5802 y downgrade when the server is configured for channel binding.

Needed for pgdogdev/pgdog#1453 (see also the follow-up pgdog PR).

Test plan

  • cargo test — existing non-PLUS handshakes stay green
  • New PLUS handshake succeeds with matching tls-server-end-point data
  • Mismatched cbind data fails; wrong password still returns NotAuthenticated
  • Stored-key (pg_shadow) PLUS handshake succeeds
  • y / n / type-mismatch still rejected when the server requires binding

Made with Cursor

AuthMessage c= is base64(gs2-header || cbind-data) when the GS2 flag is p.
Without that, SCRAM-SHA-256-PLUS clients fail even when the header parses.
Also add a PLUS client and reject the RFC 5802 y downgrade.

Co-authored-by: Cursor <cursoragent@cursor.com>
Rejecting n is this server's require-channel-binding policy, not a
section 6 MUST.

Co-authored-by: Cursor <cursoragent@cursor.com>
@levkk
levkk merged commit ee15a47 into pgdogdev:master Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants