Re: Improve OAuth discovery logging
Zsolt Parragi <zsolt.parragi@percona.com>
From: Zsolt Parragi <zsolt.parragi@percona.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Jacob Champion <jacob.champion@enterprisedb.com>,
Andrey Borodin <x4mmm@yandex-team.ru>, Daniel Gustafsson <daniel@yesql.se>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2026-03-17T05:29:04Z
Lists: pgsql-hackers
> As is_log_level_output() returns false against FATAL_CLIENT_ONLY, so that FATAL_CLIENT_ONLY should not reach send_message_to_server_log(). Should we assert edata->elevel != FATAL_CLIENT_ONLY? Andrey asked the same question upthread, this mirrors how WARNING_CLIENT_ONLY is implemented. > As far as I understand, for a programmer error, Assert should be used. Why do we use elog(ERROR) here? +1, I would also say that for CheckSASLAuth, specifying abandoned is always required, since the caller can't know when it will result in an error. So the assert/if should be at the beginning of the function, not in the error path. Or instead: + /* + * "Abandoned" is a SASL-specific state similar to STATUS_EOF, in that we + * don't want to generate any server logs. But it's caused by an in-band + * client action that requires a server response, not an out-of-band + * connection closure, so we can't just proc_exit() like we do with + * STATUS_EOF. + */ + bool abandoned = false; + Have you considered adding the error level here instead, the same way as in auth_failed, explicitly defaulted to normal fatal by the caller, so existing code don't have to change it? That wouldn't need an SASL-specific explanation or flag in the generic code.
Commits
-
oauth: Don't log discovery connections by default
- e020a897efea 19 (unreleased) landed
-
sasl: Allow backend mechanisms to "abandon" exchanges
- c4ff16339f07 19 (unreleased) landed
-
Add FATAL_CLIENT_ONLY to ereport/elog
- c2bca7cc9621 19 (unreleased) landed
-
oauth_validator: Avoid races in log_check()
- ab8af1db4303 19 (unreleased) cited