From 6219a268df4fefdd99bf64a3c2de9548338cbc62 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Wed, 1 Apr 2026 10:29:16 -0700 Subject: [PATCH v3.1 2/6] squash! Split PGOAUTHDEBUG=UNSAFE into multiple options - Rename user-facing options in parsing and documentation. - Move dos-endpoint to UNSAFE. - Realign lineannotations and update doc descriptions. --- doc/src/sgml/libpq.sgml | 45 ++++++++++------------ src/interfaces/libpq/fe-auth-oauth-debug.c | 9 +++-- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 2e5fb9011e9..01a65419f99 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -10649,9 +10649,9 @@ typedef struct debug options: -PGOAUTHDEBUG=option1,option2,... for safe options only -PGOAUTHDEBUG=UNSAFE:option1,option2,... when using unsafe options -PGOAUTHDEBUG=UNSAFE legacy format; enables all options +PGOAUTHDEBUG=option1,option2,... for safe options only +PGOAUTHDEBUG=UNSAFE:option1,option2,... when using unsafe options +PGOAUTHDEBUG=UNSAFE legacy format; enables all options @@ -10684,29 +10684,29 @@ PGOAUTHDEBUG=UNSAFE legacy format; enables all options - fast-retry (safe) + dos-endpoint (unsafe) Permits the use of zero-second retry intervals instead of the normal - minimum of one second. This can speed up tests but may cause the client - to busy-loop and consume CPU unnecessarily. + minimum of one second. This speeds up tests, but in normal operation it + will cause the client to busy-loop, consuming CPU and network resources. - poll-counts (safe) + call-count (safe) - Prints the total number of poll() calls to standard error when the - OAuth flow completes. This helps developers debug the async multiplexer - behavior. + Prints the total number of calls to the flow plugin to standard error + when the OAuth flow completes. This helps developers debug the async + callback behavior. - print-plugin-errors (safe) + plugin-errors (safe) Prints plugin loading errors to standard error. This helps developers @@ -10718,13 +10718,12 @@ PGOAUTHDEBUG=UNSAFE legacy format; enables all options - Unsafe options (http, trace) - require the UNSAFE: prefix. + Unsafe options (http, trace, + dos-endpoint) require the UNSAFE: prefix. If unsafe options are specified without this prefix, a warning is printed to standard error and that option is ignored. Other valid options in the - list continue to work. Safe options (fast-retry, - poll-counts, print-plugin-errors) can - be used without the prefix. + list continue to work. Safe options (call-count, + plugin-errors) can be used without the prefix. @@ -10736,19 +10735,17 @@ PGOAUTHDEBUG=UNSAFE legacy format; enables all options Examples: -PGOAUTHDEBUG=fast-retry,poll-counts safe options only -PGOAUTHDEBUG=UNSAFE:http,trace enable HTTP and traffic logging -PGOAUTHDEBUG=UNSAFE:http,poll-counts mix of unsafe and safe -PGOAUTHDEBUG=UNSAFE legacy; enables all options +PGOAUTHDEBUG=call-count safe options only +PGOAUTHDEBUG=UNSAFE:http,trace enable HTTP and traffic logging +PGOAUTHDEBUG=UNSAFE:http,call-count mix of unsafe and safe - Never use unsafe debug options in production environments. The - trace option in particular exposes secrets that can be - used to attack your clients and servers. Do not share the output with third - parties. + Never use unsafe debug options in production environments. They expose + secrets and behaviors that can be used to attack your clients and servers. + Do not share trace output with third parties. diff --git a/src/interfaces/libpq/fe-auth-oauth-debug.c b/src/interfaces/libpq/fe-auth-oauth-debug.c index f9a1b1f195f..957da5d4068 100644 --- a/src/interfaces/libpq/fe-auth-oauth-debug.c +++ b/src/interfaces/libpq/fe-auth-oauth-debug.c @@ -47,18 +47,19 @@ parse_debug_option(const char *option, oauth_debug_flags *flags, bool *is_unsafe *is_unsafe = true; return true; } - /* Safe options */ - else if (strcmp(option, "fast-retry") == 0) + else if (strcmp(option, "dos-endpoint") == 0) { flags->fast_retry = true; + *is_unsafe = true; return true; } - else if (strcmp(option, "poll-counts") == 0) + /* Safe options */ + else if (strcmp(option, "call-count") == 0) { flags->poll_counts = true; return true; } - else if (strcmp(option, "print-plugin-errors") == 0) + else if (strcmp(option, "plugin-errors") == 0) { flags->print_plugin_errors = true; return true; -- 2.34.1