Skip to content

Add SCRAM-SHA-256-PLUS support - #1008

Closed
jawj wants to merge 1 commit into
porsager:masterfrom
jawj:master
Closed

jawj wants to merge 1 commit into
porsager:masterfrom
jawj:master

Conversation

@jawj

@jawj jawj commented Jan 11, 2025

Copy link
Copy Markdown

Hello. I hope you'll consider this patch, which adds support for SCRAM-SHA-256-PLUS authentication.

SCRAM-SHA-256-PLUS in Postgres enables tls-server-end-point channel binding, where the client sends the server a hash of the certificate it received as part of the TLS handshake. This prevents some kinds of MITM attacks where the attacker obtains a certificate that appears valid for the server, but is not actually the server's.

So far I've tested it working against Neon (who support SCRAM-SHA-256-PLUS) and Supabase (who don't).

Feel free to make any changes you think appropriate.

@jawj

jawj commented Jan 12, 2025

Copy link
Copy Markdown
Author

I realise this will probably need some extra work for Cloudflare on the hash/digest method.

@porsager
porsager force-pushed the master branch 2 times, most recently from 4fd011e to a92f470 Compare May 20, 2025 23:40
@porsager
porsager force-pushed the master branch 2 times, most recently from 4a0fe34 to 3a43815 Compare November 12, 2025 04:40
@jawj

jawj commented Jan 8, 2026

Copy link
Copy Markdown
Author

@porsager Any thoughts on adding support for channel binding (SCRAM-SHA-256-PLUS) — based on this PR or otherwise?

node-postgres merged this a while back:
https://node-postgres.com/features/ssl#channel-binding
brianc/node-postgres#3356

It's currently behind a custom config flag there, but it would be nicer to support channel_binding as disable, prefer (the default), or require, same as libpq does.

@porsager

Copy link
Copy Markdown
Owner

Thanks! This is part of v4 (06cf284), so I am closing it here. The changelog has the details: https://github.com/porsager/postgres/blob/master/CHANGELOG.md

@porsager porsager closed this Oct 29, 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