Skip to content

Commit

Permalink
Make note about possible parse config error message redaction change
Browse files Browse the repository at this point in the history
  • Loading branch information
jackc committed Jan 12, 2024
1 parent 5d26bbe commit f654d61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pgconn/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f654d61

Please sign in to comment.