]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
postgres_fdw, dblink: Validate use_scram_passthrough values
authorFujii Masao <fujii@postgresql.org>
Thu, 28 May 2026 11:58:08 +0000 (20:58 +0900)
committerFujii Masao <fujii@postgresql.org>
Thu, 28 May 2026 11:58:08 +0000 (20:58 +0900)
The use_scram_passthrough option in postgres_fdw and dblink accepts
only boolean values. However, unlike other boolean options such as
keep_connections, its value was not previously validated.

As a result, commands such as
"CREATE SERVER ... OPTIONS (use_scram_passthrough 'invalid')"
could succeed unexpectedly.

This commit updates postgres_fdw and dblink to validate that
use_scram_passthrough is assigned a valid boolean value, and throw an
error for invalid input.

Backpatch to v18, where use_scram_passthrough was introduced.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwF+-k-Ehsu5W94ZP7GxS3wiBd+mi0PfGTdJ_i2Yr0zR3g@mail.gmail.com
Backpatch-through: 18

contrib/dblink/dblink.c
contrib/postgres_fdw/option.c

index 448d469aba8cc4c7ffb21f8c771126b00c2916d2..3329f9ac0cc393425b844ca9fc060726ab2ae46e 100644 (file)
@@ -1995,6 +1995,9 @@ dblink_fdw_validator(PG_FUNCTION_ARGS)
                                                         closest_match) : 0 :
                                         errhint("There are no valid options in this context.")));
                }
+
+               if (strcmp(def->defname, "use_scram_passthrough") == 0)
+                       (void) defGetBoolean(def);      /* accept only boolean values */
        }
 
        PG_RETURN_VOID();
index 3944aedbaccbe4a307dd214e0484b593b61e1ef7..79b16c3f31843dbc1abafca7fca72947d4a46366 100644 (file)
@@ -121,7 +121,8 @@ postgres_fdw_validator(PG_FUNCTION_ARGS)
                        strcmp(def->defname, "parallel_commit") == 0 ||
                        strcmp(def->defname, "parallel_abort") == 0 ||
                        strcmp(def->defname, "keep_connections") == 0 ||
-                       strcmp(def->defname, "restore_stats") == 0)
+                       strcmp(def->defname, "restore_stats") == 0 ||
+                       strcmp(def->defname, "use_scram_passthrough") == 0)
                {
                        /* these accept only boolean values */
                        (void) defGetBoolean(def);