Redact sensitive connection parameters in logs#184
Conversation
Avoid writing libpq password and SSL-related connection parameter values to the driver logs. This covers both the raw pqopt trace and the expanded PQconnectdbParams keyword/value trace.
595a0c7 to
f83f59e
Compare
|
Summary Prevents passwords and SSL credential paths from being written to driver debug/communication logs. Two logging sites
Code Review is_sensitive_conninfo_param() helper: static BOOL
Sensitive keyword list: The list covers: password, passfile, sslpassword, sslkey, sslcert, sslrootcert, sslcrl, sslcrldir. Observations:
pqopt redaction: MYLOG(0, "connecting to the database using %s as the server and pqopt={%s}\n",
PQconnectdbParams trace redaction: if (is_sensitive_conninfo_param(*popt))
Issues / Suggestions
Verdict Clean, well-scoped security improvement. The code is correct and minimal. The only real question is whether to Recommendation: Merge-worthy. Optionally narrow the redaction list to password, passfile, sslpassword, sslkey if you |
Summary
This avoids writing sensitive libpq connection parameter values to the driver logs when debug or communication logging is enabled.
The previous LIBPQ_connect() logging path printed:
That can expose values such as password, passfile, sslpassword, sslkey, sslcert, sslrootcert, sslcrl, and sslcrldir in debug logs.
Changes
Verification
I did not add a regression test because this path depends on driver log file output and logging configuration. The change is limited to log formatting and does not affect the values passed to PQconnectdbParams().