Re: unclear OAuth error message

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: unclear OAuth error message
Date: 2026-01-26 22:43:52
Message-ID: CAOYmi+=6tq-3YAqUiEs+8yHL5mQebsz864ddt6ruNGyfQApJdg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 26, 2026 at 12:53 AM Zsolt Parragi
<zsolt(dot)parragi(at)percona(dot)com> wrote:
> I also want to add that these error messages are not that useful for
> figuring out what went wrong. In practice, the validator has to report
> more specific error messages before this happens, otherwise the user
> won't be able to figure out why we are rejecting some login.

Right.

> And if it reports an error, and stops the code flow, these won't be
> displayed at all - but then why do we have all these bool outputs in
> the validator?

In general, don't stop the code flow. We want failures to be handled
in-band [1] so that the server's communication with an unauthenticated
client is standard across validators and auth methods. (Our SASL
abstraction layer is leaky here, in the sense that mechanisms have too
much power over the network layer.)

And in general, we want to avoid leaking token information to
unauthenticated clients. The server should not act as an oracle for
people with ill-gotten tokens.

> And even the messages in the caller code are
> WARNING/LOG. The intention of the API seems to be to report WARNINGs
> for validation failures, even internal errors, so for now we added
> most error checks in the validator as that, allowing the code to
> continue.

COMMERROR (LOG_SERVER_ONLY), which is also documented in [1], is a
good bet. WARNING is fine only in the sense that it's not emitted
during authentication, but it'd be odd to see a warning for a
run-of-the-mill validation failure. (For internal errors, like "I
couldn't get the public keys", I think WARNING probably makes sense.
Or if something causes you to think that somebody is under active
attack.)

--Jacob

[1] https://www.postgresql.org/docs/18/oauth-validator-design.html#OAUTH-VALIDATOR-DESIGN-GUIDELINES

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-01-26 22:48:59 Re: Cleaning up PREPARE query strings?
Previous Message Chao Li 2026-01-26 22:41:56 Re: docs: clarify ALTER TABLE behavior on partitioned tables