From f654d61d792865c428cff645c9c979ec7ab7f531 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 12 Jan 2024 17:56:13 -0600 Subject: [PATCH] Make note about possible parse config error message redaction change --- pgconn/errors.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pgconn/errors.go b/pgconn/errors.go index f2a72cd6a..c315739a9 100644 --- a/pgconn/errors.go +++ b/pgconn/errors.go @@ -97,6 +97,9 @@ type ParseConfigError struct { } func (e *ParseConfigError) Error() string { + // Now that ParseConfigError is public and ConnString is available to the developer, perhaps it would be better only + // return a static string. That would ensure that the error message cannot leak a password. The ConnString field would + // allow access to the original string if desired and Unwrap would allow access to the underlying error. connString := redactPW(e.ConnString) if e.err == nil { return fmt.Sprintf("cannot parse `%s`: %s", connString, e.msg)