Re: BUG #19600: pgcrypto crypt() can return text with invalid encoding

From: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
To: Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>
Cc: malis(at)pgrust(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19600: pgcrypto crypt() can return text with invalid encoding
Date: 2026-11-13 18:43:31
Message-ID: CAB8bMiugbao+0141U4kt55q8U3EBEiEJzCsTiKX=VT2qy-4ZZA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

ср, 28 окт. 2026 г. в 14:09, Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>:

> Two points:
>
> 1. Hashes already stored with invalid encoding stop working after the
> upgrade: crypt(pw, stored_hash) now raises an error instead of
> returning a hash to compare, for the right password as well as a
> wrong one. That seems acceptable to me, since the stored value
> already can't be dumped and restored, and it's a similar trade-off
> to the one the PGP decrypt functions made in d536aee5566, although
> unlike those, crypt() has no bytea variant to fall back on. It may
> be worth a mention in the release notes.
>
> 2. The new test covers only DES. Since the fix handles xDES and MD5 as
> well, it might be worth adding those cases from the report.
>
>
Hi, Ishjaap!

Thanks for the review.

I've updated the commit message and added the test cases for item 2.

--
Regards,
Rachitskiy Andrey

Attachment Content-Type Size
v2-0001-pgcrypto-Reject-crypt-results-invalid-in-database-encoding.patch text/x-patch 5.4 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-11-13 19:10:39 Re: BUG #19866: acldefault() emits invalid UTF-8 for a high-bit "char" value
Previous Message Masahiko Sawada 2026-11-13 17:49:08 Re: BUG #19702: decode() accepts Base64 payload after terminal padding