postgresql/src/interfaces/libpq
Jacob Champion 6d00fb9048 libpq: Split PGOAUTHDEBUG=UNSAFE into multiple options
PGOAUTHDEBUG is a blunt instrument: you get all the debugging features,
or none of them. The most annoying consequence during manual use is the
Curl debug trace, which tends to obscure the device flow prompt
entirely. The promotion of PGOAUTHCAFILE into its own feature in
993368113 improved the situation somewhat, but there's still the
discomfort of knowing you have to opt into many dangerous behaviors just
to get the single debug feature you wanted.

Explode the PGOAUTHDEBUG syntax into a comma-separated list. The old
"UNSAFE" value enables everything, like before. Any individual unsafe
features still require the envvar to begin with an "UNSAFE:" prefix, to
try to interrupt the flow of someone who is about to do something they
should not.

So now, rather than

    PGOAUTHDEBUG=UNSAFE        # enable all the unsafe things

a developer can say

    PGOAUTHDEBUG=call-count    # only show me the call count. safe!
    PGOAUTHDEBUG=UNSAFE:trace  # print secrets, but don't allow HTTP

To avoid adding more build system scaffolding to libpq-oauth, implement
this entirely in a small private header. This unfortunately can't be
standalone, so it needs a headerscheck exception.

Author: Zsolt Parragi <zsolt.parragi@percona.com>
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://postgr.es/m/CAOYmi%2B%3DfbZNJSkHVci%3DGpR8XPYObK%3DH%2B2ERRha0LDTS%2BifsWnw%40mail.gmail.com
Discussion: https://postgr.es/m/CAN4CZFMmDZMH56O9vb_g7vHqAk8ryWFxBMV19C39PFghENg8kA%40mail.gmail.com
2026-04-07 08:15:14 -07:00
..
po Update copyright for 2026 2026-01-01 13:24:10 -05:00
t Fix misc typos, mostly in comments 2026-01-08 18:10:08 +02:00
test Prevent -Wstrict-prototypes and -Wold-style-definition warnings 2026-03-16 10:53:24 +01:00
.gitignore Run tap tests in src/interfaces/libpq. 2022-02-26 16:51:47 -08:00
exports.txt libpq: Add PQgetThreadLock() to mirror PQregisterThreadLock() 2026-03-05 10:04:48 -08:00
fe-auth-oauth.c libpq: Split PGOAUTHDEBUG=UNSAFE into multiple options 2026-04-07 08:15:14 -07:00
fe-auth-oauth.h libpq: Split PGOAUTHDEBUG=UNSAFE into multiple options 2026-04-07 08:15:14 -07:00
fe-auth-sasl.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-auth-scram.c Fix accidentally cast away qualifiers 2026-01-26 16:02:31 +01:00
fe-auth.c Fix accidentally cast away qualifiers 2026-01-26 16:02:31 +01:00
fe-auth.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-cancel.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-connect.c libpq: Add oauth_ca_file option to change CAs without debugging 2026-03-30 14:14:45 -07:00
fe-exec.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-gssapi-common.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-gssapi-common.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-lobj.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-misc.c libpq: Grease the protocol by default 2026-02-23 10:48:20 -08:00
fe-print.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-protocol3.c libpq: Grease the protocol by default 2026-02-23 10:48:20 -08:00
fe-secure-common.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-secure-common.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-secure-gssapi.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-secure-openssl.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe-secure.c Use fallthrough attribute instead of comment 2026-02-19 08:51:12 +01:00
fe-trace.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
legacy-pqsignal.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
libpq-events.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
libpq-events.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
libpq-fe.h libpq: Introduce PQAUTHDATA_OAUTH_BEARER_TOKEN_V2 2026-03-06 12:05:51 -08:00
libpq-int.h libpq: Add oauth_ca_file option to change CAs without debugging 2026-03-30 14:14:45 -07:00
libpq_check.pl Force creation of stamp file after libpq library check in meson builds 2026-02-18 16:07:13 +09:00
Makefile Restore AIX support. 2026-02-23 13:34:22 -05:00
meson.build Restore AIX support. 2026-02-23 13:34:22 -05:00
nls.mk libpq: Align oauth_json_set_error() with other NLS patterns 2025-12-15 13:22:04 -08:00
oauth-debug.h libpq: Split PGOAUTHDEBUG=UNSAFE into multiple options 2026-04-07 08:15:14 -07:00
pg_service.conf.sample Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
pqexpbuffer.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
pqexpbuffer.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pthread-win32.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
README Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
win32.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
win32.h Recognize network-failure errnos as indicating hard connection loss. 2020-10-10 13:28:12 -04:00

src/interfaces/libpq/README

This directory contains the C version of Libpq, the POSTGRES frontend library.