Re: Non-compliant SASLprep implementation for ASCII characters
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-23T23:33:10Z
Lists: pgsql-hackers
Attachments
- scram_utils.tar.gz (application/gzip)
On Thu, Mar 19, 2026 at 01:25:52PM +0900, Michael Paquier wrote:
> Applied the result for the module, to have at least the coverage part.
> The last piece is refreshed, and attached for now.
I have worked on the final piece of this thread, and applied it.
I am also attaching a small module, called scram_utils(), that I have
used to validate this change by creating SCRAM verifiers with
non-printable ASCII characters, like:
SELECT scram_utils_verifier_bytea('myrole', '\x010203', 200, 10);
This function passes down the password data to scram_build_secret()
after applying pg_saslprep(), reusing the original password if
the SASLprep was not a success. That's the same as what we do in
pg_be_scram_build_secret() but I wanted control over the salt length
and the number of iterations for each function call (implemented that
years ago with tested SCRAM), hence the split.
Then use for example something like that for the input:
export PGPASSWORD=$(printf '%b%b%b' '\01\02\03')
The validation between the non-compliant and the compliant
implementation then comes down to:
- Generate the rolpassword on HEAD patched (new) and unpatched (old).
- Check connections with libpq patched (new) and unpatched (old), with
client->server as of new->old, old->new, new->new.
--
Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
test_saslprep: Fix issue with copy of input bytea
- 5d35531af184 19 (unreleased) landed
-
Make implementation of SASLprep compliant for ASCII characters
- 3d10ece612f5 19 (unreleased) landed
-
test_saslprep: Test module for SASLprep()
- aa73838a5c94 19 (unreleased) landed