You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using pgx.Connect with the connection string format "host=%s port=%s user=%s password=%s dbname=%s", if the user field is left empty, the password field is mistakenly interpreted as the user. This leads to the following error: failed to connect to 'user=password=**** database=***': ****: failed SASL auth: FATAL: password authentication failed for user "password=****" (SQLSTATE 28P01)
In this case, the password is displayed in plain text, which constitutes an unacceptable information disclosure from a security perspective.
To Reproduce
Steps to reproduce the behavior:
Use the following connection string format: "host=%s port=%s user=%s password=%s dbname=%s".
Leave the user field empty, and set a valid password.
The connection attempt should fail with a clear error indicating that the user field is empty, without exposing the password in the error message.
Actual behavior
The password field is mistakenly interpreted as the user, resulting in an error that exposes the password in plain text:
failed to connect to 'user=password=**** database=***': : failed SASL auth: FATAL: password authentication failed for user "password="
The text was updated successfully, but these errors were encountered:
When using pgx.Connect with the connection string format "host=%s port=%s user=%s password=%s dbname=%s", if the user field is left empty, the password field is mistakenly interpreted as the user.
The resulting connection string is incorrect. It's not a parsing error. This matches PostgreSQL behavior.
To write an empty value, or a value containing spaces, surround it with single quotes
psql has the same behavior.
jack@glados ~/dev/pgx ±master » psql "host=localhost port=5432 user= password=secret dbname=mydb"
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: role "password=secret" does not exist
Describe the bug
When using
pgx.Connect
with the connection string format"host=%s port=%s user=%s password=%s dbname=%s"
, if theuser
field is left empty, thepassword
field is mistakenly interpreted as theuser
. This leads to the following error:failed to connect to 'user=password=**** database=***': ****: failed SASL auth: FATAL: password authentication failed for user "password=****" (SQLSTATE 28P01)
In this case, the
password
is displayed in plain text, which constitutes an unacceptable information disclosure from a security perspective.To Reproduce
Steps to reproduce the behavior:
"host=%s port=%s user=%s password=%s dbname=%s"
.user
field empty, and set a validpassword
.pgx.Connect
.Example code:
Expected behavior
The connection attempt should fail with a clear error indicating that the user field is empty, without exposing the password in the error message.
Actual behavior
The password field is mistakenly interpreted as the user, resulting in an error that exposes the password in plain text:
failed to connect to 'user=password=**** database=***': : failed SASL auth: FATAL: password authentication failed for user "password="
The text was updated successfully, but these errors were encountered: