Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use the collector when there is a hash (#) in the password #124

Closed
shamil opened this issue Dec 15, 2020 · 7 comments
Closed

Can't use the collector when there is a hash (#) in the password #124

shamil opened this issue Dec 15, 2020 · 7 comments

Comments

@shamil
Copy link

shamil commented Dec 15, 2020

I guess it treat everything after hash as comment.

@msakrejda
Copy link
Contributor

Hi @shamil--thanks for the report. Have you tried escaping the hash in the password value with a backslash, or quoting the entire value?

@caleb15
Copy link
Contributor

caleb15 commented Dec 22, 2020

I ran into this too - see #132. I fixed it by replacing the hash. Hashes should be allowed in passwords without having to escape them IMO. Or if that doesn't work for some reason it would be nice if pganalyze raised a error telling you to fix the password. Currently it dies to a seg violation.

@msakrejda
Copy link
Contributor

@caleb15 oh wow, it definitely shouldn't segfault. I only suggested quoting or escaping because a hash is a .ini comment character, so I assumed the hash and everything after were being ignored, leading to a different password. Are you setting the password via db_password or db_url?

@msakrejda
Copy link
Contributor

So I tried this myself with db_url and I was able to reproduce the crash. The hash character is treated as a comment by https://github.com/go-ini/ini, which we use for parsing the config file, and the resulting invalid URL fails to parse, and we're not doing proper error-checking regarding valid URLs. Unfortunately, it looks like the quoting and escaping suggestions I made earlier do not solve this--looks like go-ini does not handle this correctly: go-ini/ini#277 go-ini/ini#187 .

@msakrejda
Copy link
Contributor

We have a fix in progress for the error handling in #133 to avoid the crash and allow # in values, but the root cause here is that the character is reserved in URLs (since it delineates the start of the fragment), so it must be URL-encoded as %23. Could you please try that @caleb15 @shamil? That should work even in current collector versions.

@msakrejda
Copy link
Contributor

Closing since #133 should fix this; please reopen if there are still issues.

@caleb15
Copy link
Contributor

caleb15 commented Jan 18, 2021

I'm using db_url. I fixed it by removing the hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants