Re: md5_password_warnings for password auth with MD5-encrypted passwords

Поиск
Список
Период
Сортировка
Искать

Re: md5_password_warnings for password auth with MD5-encrypted passwords

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Jun 23, 2026, at 09:39, Fujii Masao  wrote:
> 
> Hi,
> 
> While testing md5_password_warnings, I noticed that authentication
> with an MD5-encrypted password emits the expected warning when the HBA
> method is md5, but not when it is password.
> 
> Was this intentional, or just an oversight?
> 
> I couldn't find any discussion about this, so I put together the
> attached patch. It updates the authentication code to emit the same
> MD5 deprecation connection warning after successful password
> authentication when the stored password is MD5-encrypted.
> 
> Thoughts?
> 
> Regards,
> 
> -- 
> Fujii Masao
> 

Given that the original warning emission was in md5_crypt_verify(), I think it might be a bit better to keep the two private helpers in crypt.c and add the warning emission in plain_crypt_verify(), because that function has already determined the password type and authentication result.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Re: md5_password_warnings for password auth with MD5-encrypted passwords

От:
Jacob Champion <jacob.champion@enterprisedb.com>
Дата:
On Mon, Jun 22, 2026 at 9:49 PM Kyotaro Horiguchi
 wrote:
> In the password authentication case, the authentication
> protocol itself does not use MD5, and MD5 password storage is already
> warned about when the verifier is created.

Presumably the verifier was created a while back, though, in the case
of an upgrade. Personally I think it makes sense to warn whenever the
MD5 hash is used to authenticate.

No opinion on the patch implementation, though (cc'd Nathan who might?).

--Jacob


Re: md5_password_warnings for password auth with MD5-encrypted passwords

От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
On Wed, Jun 24, 2026 at 07:43:21AM -0700, Jacob Champion wrote:
> Presumably the verifier was created a while back, though, in the case
> of an upgrade. Personally I think it makes sense to warn whenever the
> MD5 hash is used to authenticate.

I'm fine with expanding the warnings to "password" auth.  Something else I
considered is whether we should warn if a role with an MD5 password is
authenticated without using the password.  I ultimately decided against
that, but we could expand it there, too.

> No opinion on the patch implementation, though (cc'd Nathan who might?).

TBH I'm not too opinionated here, if for no other reason than all this code
should be getting deleted in the next couple of years.

-- 
nathan


Re: md5_password_warnings for password auth with MD5-encrypted passwords

От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
On Mon, Jun 29, 2026 at 12:00:31PM +0900, Michael Paquier wrote:
> On Fri, Jun 26, 2026 at 01:18:55PM -0500, Nathan Bossart wrote:
>> TBH I'm not too opinionated here, if for no other reason than all this code
>> should be getting deleted in the next couple of years.
> 
> v20 perhaps?  Let's be on the very optimistic side of the spectrum.  :p

My plan was to allow a couple more years for word to spread and warnings to
be seen, and then to remove it in ~v22.  If there's consensus to do it
earlier, I'm happy to do so, but I lean towards extreme caution with the
timeline.

-- 
nathan


Re: md5_password_warnings for password auth with MD5-encrypted passwords

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Mon, Jun 29, 2026 at 12:00 PM Michael Paquier  wrote:
> > I'm fine with expanding the warnings to "password" auth.  Something else I
> > considered is whether we should warn if a role with an MD5 password is
> > authenticated without using the password.  I ultimately decided against
> > that, but we could expand it there, too.

Agreed with that decision, i.e., I don't think we should warn in those cases
(e.g., a role with an MD5 password being authenticated via trust). The MD5
verifier isn't used for authentication there, and emitting the warning would
require an extra lookup of the role's password solely to generate the warning.
That seems like unnecessary overhead.


> FWIW, emitting a WARNING for the "password" case would make more
> people aware that they're doing something wrong.  Folks having the
> idea to allow plain password authentication should be hopefully next
> to nothing these days (mostly self-managed), but the more warned the
> less potential pain when this gets removed.

+1


> In short, I think that Fujii-san's patch is a good thing to have.

Thanks! So I'm thinking to commit the patch.

Regards,

-- 
Fujii Masao


Re: md5_password_warnings for password auth with MD5-encrypted passwords

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Tue, Jun 30, 2026 at 9:38 AM Fujii Masao  wrote:
> > In short, I think that Fujii-san's patch is a good thing to have.
>
> Thanks! So I'm thinking to commit the patch.

I've pushed the patch. Thanks!

Regards,

-- 
Fujii Masao


pgsql: GiST: Invalidate killed items consistently.

От:
Peter Geoghegan <pg@bowt.ie>
Дата:
Вложения:
GiST: Invalidate killed items consistently.

GiST neglected to invalidate its killedItems[] array on a rescan.  As a
result, it was just about possible for the wrong tuples from the wrong
index page to be LP_DEAD-marked on a rescan.  The scan mistakenly
believed that the previous rescan's killedItems[] were for this rescan's
curBlkno, causing index corruption.

To fix, bring GiST in line with nbtree and hash: call gistkillitems from
both gistrescan and gistendscan (the existing gistgettuple caller still
handles the common case where we need to LP_DEAD-mark before moving on
to the next page).  That way the scan's pending killedItems[] are passed
to gistkillitems while they still describe items from curBlkno.  When
gistkillitems runs, it'll invalidate the array in passing (and won't
needlessly miss out on an opportunity to LP_DEAD-mark eligible index
tuples).  Back branches just get minimal hardening: we invalidate
killedItems[] at the places where the master branch gets new calls to
gistkillitems (and we invalidate curBlkno and curPageLSN on a rescan).

The test that proved corruption on master didn't result in corruption on
any stable branch, though only because, without commit 9c9ddf109, we'd
clobber curPageLSN without also updating curBlkno -- which accidentally
prevented it.  Relying on gistkillitems to not LP_DEAD-mark by passing
it a curBlkno whose curPageLSN was taken from an entirely different page
seems like a very bad idea, which is why this issue is being treated as
a bug affecting all stable branches.

Author: Peter Geoghegan 
Reviewed-By: Andrey Borodin 
Discussion: https://postgr.es/m/CAH2-WzmwEThnQf17Ju+t0N9_KJLsEQSXzYrFnaS2=s4KnGGrqw@mail.gmail.com
Backpatch-through: 14

Branch
------
master

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

Modified Files
--------------
src/backend/access/gist/gistget.c  | 44 ++++++++++++++++++++++----------------
src/backend/access/gist/gistscan.c | 10 +++++++++
src/include/access/gist_private.h  |  1 +
3 files changed, 36 insertions(+), 19 deletions(-)

FAQ