Re: unclear OAuth error message

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Subject: Re: unclear OAuth error message
Date: 2026-01-26 08:53:00
Message-ID: CAN4CZFOCMpzeRK8e1Y=9AWrVE3ZASCgv_Z1-V1dhfR_-0ZykzA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> But the code suggests that the module worked fine and made the
> determination not to authorize the user. If that's so, then why do we
> have the errdetail at all? Can't we just get rid of it and let the
> errmsg stand on its own merit?

This also confused me when I worked on our validator plugin. But the
validator has two places to return failure:

* res->authorized, which should be true if we are allowed to continue
with the login, false if not
* and the return value, which should be true if the validation process
completed successfully, false if not

At least that's how I understand it. This check is about the first
one, which means there wasn't any problem during the validation
process, but the validator decided not to allow the login to proceed.

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. (both for
internal errors and rejecting authentication)

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? 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-01-26 08:56:36 Re: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions
Previous Message Bertrand Drouvot 2026-01-26 08:41:53 Re: Safer hash table initialization macro