PostgreSQL applies SASLprep to the presented password at login, and
ALTER ROLE ... PASSWORD did the same when it stored the old verifier, so
a SCRAM verifier built from the raw bytes of a legacy password silently
fails to authenticate any password SASLprep changes, such as one
carrying a soft hyphen. CarriesOver tells the conversion which passwords
it may keep, so the rest are left to their first mint.
pg_saslprep returns every all-ASCII input unchanged through its
pg_is_ascii fast path before the prohibited-character step runs, so an
all-ASCII password, ASCII controls included, carries over. Every format
other than scram-sha-256 stores or hashes the raw bytes and always
carries over.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The platform stores what an engine checks a password against, not the
password: a SCRAM-SHA-256 verifier for PostgreSQL, the
mysql_native_password hash for MariaDB, the SHA-256 hex for ClickHouse,
and the plaintext only for an engine whose operator computes its own
verifier. The migration tooling imports the same package, so a converted
release and a mint store the same form.
CodeQL flags the SHA-1 and SHA-256 of a password as weak hashing of
sensitive data. Both are the forms the engines store and check against
and accept in no other form, and the design relies on the 32-character
random password rather than on the digest for strength, so the code says
that where the hashing happens.
Assisted-by: LLM
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>