]> git.ipfire.org Git - thirdparty/postgresql.git/commit
test_saslprep: Test module for SASLprep()
authorMichael Paquier <michael@paquier.xyz>
Thu, 19 Mar 2026 04:03:30 +0000 (13:03 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 19 Mar 2026 04:03:30 +0000 (13:03 +0900)
commitaa73838a5c94457552d261968f63ee6ea6e366f5
treeba1dcb6a944ec9b246fb4b659d3f7d58a0ba3c73
parent79a5911fe65be80d4a4cb6ca6f90ae7d2cc6e9bc
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
13 files changed:
doc/src/sgml/regress.sgml
src/test/modules/Makefile
src/test/modules/meson.build
src/test/modules/test_saslprep/.gitignore [new file with mode: 0644]
src/test/modules/test_saslprep/Makefile [new file with mode: 0644]
src/test/modules/test_saslprep/README [new file with mode: 0644]
src/test/modules/test_saslprep/expected/test_saslprep.out [new file with mode: 0644]
src/test/modules/test_saslprep/meson.build [new file with mode: 0644]
src/test/modules/test_saslprep/sql/test_saslprep.sql [new file with mode: 0644]
src/test/modules/test_saslprep/t/001_saslprep_ranges.pl [new file with mode: 0644]
src/test/modules/test_saslprep/test_saslprep--1.0.sql [new file with mode: 0644]
src/test/modules/test_saslprep/test_saslprep.c [new file with mode: 0644]
src/test/modules/test_saslprep/test_saslprep.control [new file with mode: 0644]