pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: test_saslprep: Test module for SASLprep()
Date: Thu, 19 Mar 2026 04:04:10 +0000
Message-ID: <E1w34cD-000R2t-2Q@gemulon.postgresql.org> (raw)

test_saslprep: Test module for SASLprep()

This module includes two functions:
- test_saslprep(), that performs pg_saslprep on a bytea.
- test_saslprep_ranges(), able to check for all valid ranges of UTF-8
codepoints pg_saslprep() handles each one of them.

This provides a detailed coverage of our implementation of SASLprep()
used for SCRAM, with:
- ASCII characters.
- Incomplete UTF-8 sequences, for 390b3cbbb2af (later backpatched).
- A more advanced check for all the valid UTF-8 ranges of codepoints, to
check for cases where these generate an empty password, based on an
original suggestion from Heikki Linnakangas.  This part consumes
resources and time, so it is implemented as a TAP test under a
new PG_TEST_EXTRA value.

A different patch is still under discussion to tweak our internal
SASLprep() implementation, and this module can be used to track any
changes in behavior.

Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aaEJ-El2seZHeFcG@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/aa73838a5c94457552d261968f63ee6ea6e366f5

Modified Files
--------------
doc/src/sgml/regress.sgml                          |  10 +
src/test/modules/Makefile                          |   1 +
src/test/modules/meson.build                       |   1 +
src/test/modules/test_saslprep/.gitignore          |   4 +
src/test/modules/test_saslprep/Makefile            |  25 ++
src/test/modules/test_saslprep/README              |  25 ++
.../test_saslprep/expected/test_saslprep.out       | 152 +++++++++++
src/test/modules/test_saslprep/meson.build         |  38 +++
.../modules/test_saslprep/sql/test_saslprep.sql    |  19 ++
.../modules/test_saslprep/t/001_saslprep_ranges.pl |  38 +++
.../modules/test_saslprep/test_saslprep--1.0.sql   |  30 +++
src/test/modules/test_saslprep/test_saslprep.c     | 277 +++++++++++++++++++++
.../modules/test_saslprep/test_saslprep.control    |   5 +
13 files changed, 625 insertions(+)



Message-ID: <E1w34cD-000R2t-2Q@gemulon.postgresql.org>
Permalink:  ../E1w34cD-000R2t-2Q@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w34cD-000R2t-2Q@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: test_saslprep: Test module for SASLprep()
  In-Reply-To: <E1w34cD-000R2t-2Q@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox