Passwords in .pgpass with spaces cause error Unable to set up worker conn #0: missing "="
jschaf opened this issue · comments
I have a pgpass file that contains a password with spaces, like so:
my-host.com:5432:postgres:postgres:alpha bravo charlie
When running pg_repack, I see a warning in the logs that leaks the second word of the password, bravo
INFO: Dry run enabled, not executing repack
NOTICE: Setting up workers.conns
WARNING: Unable to set up worker conn #0: missing "=" after "bravo" in connection info string
INFO: repacking table "table1"
INFO: repacking table "table2"
...
It seems like the command still works, but reporting since pg_repack shouldn't leak partial passwords.
Taking a glance at the code, the problem seems to be that appending the password in setup_workers
doesn't quote strings with whitespace at:
Line 65 in 3ecda64
So the conn string parser sees something like:
host=my-host.com password=alpha bravo charlie
The parser attempts to interpret bravo
as a key instead of part of the password string.
Fixed by the PR #384. Closing the issue.