Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Champion2025-04-29 20:08:55 +0000
committerJacob Champion2025-04-29 20:08:55 +0000
commite974f1c2164bc677d55f98edaf99f80c0b6b89d9 (patch)
treee3ea2c35bff21a543ac2fefc5d8132daf21a26a9 /src/interfaces/libpq/fe-connect.c
parentd2e7d2a09d7d17656418f8c859074db690af19ec (diff)
oauth: Classify oauth_client_secret as a password
Tell UIs to hide the value of oauth_client_secret, like the other passwords. Due to the previous commit, this does not affect postgres_fdw and dblink, but add a comment to try to warn others of the hazard in the future. Reported-by: Noah Misch <noah@leadboat.com> Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20250415191435.55.nmisch%40google.com
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index bd51e6115cf..430c0fa4442 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -158,6 +158,12 @@ static int ldapServiceLookup(const char *purl, PQconninfoOption *options,
* "*" Password field - hide value
* "D" Debug option - don't show by default
*
+ * NB: Server-side clients -- dblink, postgres_fdw, libpqrcv -- use dispchar to
+ * determine which options to expose to end users, and how. Changing dispchar
+ * has compatibility and security implications for those clients. For example,
+ * postgres_fdw will attach a "*" option to USER MAPPING instead of the default
+ * SERVER, and it disallows setting "D" options entirely.
+ *
* PQconninfoOptions[] is a constant static array that we use to initialize
* a dynamically allocated working copy. All the "val" fields in
* PQconninfoOptions[] *must* be NULL. In a working copy, non-null "val"
@@ -394,7 +400,7 @@ static const internalPQconninfoOption PQconninfoOptions[] = {
offsetof(struct pg_conn, oauth_client_id)},
{"oauth_client_secret", NULL, NULL, NULL,
- "OAuth-Client-Secret", "", 40,
+ "OAuth-Client-Secret", "*", 40,
offsetof(struct pg_conn, oauth_client_secret)},
{"oauth_scope", NULL, NULL, NULL,