connector-x icon indicating copy to clipboard operation
connector-x copied to clipboard

Add support for pgpass

Open surister opened this issue 1 year ago • 3 comments

We follow the spec in https://www.postgresql.org/docs/current/libpq-pgpass.html,

Order of passfile path is:

  1. passfile path specified in connection string, e.g. postgresql://localhost:5432?passfile=/home/someuser/secret/.pgpass
  2. default path ~/.pgpass in *nix, %APPDATA%\postgresql\pgpass.conf in windows.
  • pgpass file needs to have safe permissions 0600 or we raise an exception.
  • pgpass needs to follow the spec format, host:port:db_name:user_name:password, so *:*:*:*:password is valid, just password is not.

pgpassfile has precedence over the given connection string.

Fixes: #567

surister avatar Jul 27 '24 14:07 surister