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

Do not return connection string in error on failure to parse user info #954

Open
hak33m16 opened this issue Oct 28, 2024 · 0 comments
Open

Comments

@hak33m16
Copy link

hak33m16 commented Oct 28, 2024

Currently, if the user info fails to get parsed correctly out of the URL, the entire contents is returned back. This is problematic because many people such as myself log these error messages, and rely on them for debugging. In this case, my database username and password were logged

I ran into this because I accidentally included a space before my password:

db, err := sqlx.Connect("postgres", conf.DBURL)
if err != nil {
    panic(fmt.Errorf("failed to initialize db connection: %w", err))
}
panic: failed to initialize db connection: parse "postgres://dummy_user: <redacted>@dummywebsite.com:12241/dummy_db": net/url: invalid userinfo

goroutine 1 [running]:
main.main()
 /workspace/main.go:43 +0xeee
exit status 2

I would have just expected a message saying invalid userinfo in which case I would have manually inspected the secret and noticed the issue

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

1 participant