Re: Password leakage avoidance

From: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
To: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dave Cramer <davecramer(at)postgres(dot)rocks>
Subject: Re: Password leakage avoidance
Date: 2024-01-03 15:33:38
Message-ID: 2591db5b-003a-4504-b14a-175f6e1a43a6@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/2/24 7:23 AM, Sehrope Sarkuni wrote:
> Having worked on and just about wrapped up the JDBC driver patch for
> this, couple thoughts:

> 2. Password encoding should be split out and made available as its own
> functions. Not just as part of a wider "create _or_ alter a user's
> password" function attached to a connection. We went a step further and
> added an intermediate function that generates the "ALTER USER ...
> PASSWORD" SQL.

I agree with this. It's been a minute, but I had done some refactoring
on the backend-side to support the "don't need a connection" case for
SCRAM secret generation functions on the server-side[1]. But I think in
general we should split out the password generation functions, which
leads to:

> 5. Our SCRAM specific function allows for customizing the algo iteration
> and salt parameters. That topic came up on hackers previously[1]. Our
> high level "alterUserPassword(...)" function does not have those options
> but it is available as part of our PasswordUtil SCRAM API for advanced
> users who want to leverage it. The higher level functions have defaults
> for iteration counts (4096) and salt size (16-bytes).

This seems like a good approach -- the regular function just has the
defaults (which can be aligned to the PostgreSQL defaults) (or inherit
from the server configuration, which then requires the connection to be
present) and then have a more advanced API available.

Thanks,

Jonathan

[1]
https://www.postgresql.org/message-id/3a9b7126-01a0-7e1a-1b2a-a76df6176725%40postgresql.org

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2024-01-03 15:54:30 Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs
Previous Message Nathan Bossart 2024-01-03 15:29:54 Re: add AVX2 support to simd.h