-
Notifications
You must be signed in to change notification settings - Fork 18k
net/url: Parse accepts invalid userinfo strings #23392
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
Comments
Change https://golang.org/cl/87038 mentions this issue: |
CL 88535 OK for Go 1.9.3. |
Change https://golang.org/cl/88535 mentions this issue: |
…arsing URLs Fixes #23392 Change-Id: I5822b082b14d886b9c3b5ad7beebb2c01a77851b Reviewed-on: https://go-review.googlesource.com/87038 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-on: https://go-review.googlesource.com/88535 Run-TryBot: Andrew Bonventre <[email protected]>
go1.9.3 has been packaged and includes:
The release is posted at golang.org/dl. — golang.org/x/build/cmd/releasebot, Jan 22 21:02:59 UTC |
My application stopped talking to the database. Turns out database password contained a |
Oh.. How were you parsing/handling the uri? |
I was using https://github.com/jackc/pgx, which was using |
Percent encoding passes fine for me. From https://stackoverflow.com/questions/23353623/how-to-handle-special-characters-in-the-password-of-a-postgresql-url-connection package main
import (
"fmt"
"net/url"
)
func main() {
// raw := "postgresql://daniel:p$ass@localhost/test"
raw := "postgresql://daniel:p%24ass@localhost"
fmt.Printf("RAW: %q\n", raw)
u, err := url.Parse(raw)
if err != nil {
fmt.Printf("ERROR: %v\n", err)
}
fmt.Println(u.String())
}
Edit: I tried with
|
I would like to know did all those changes pass the test in OSX as I can get an After I use the docker image 1.8-apline I will update the screen shot later |
Necessary since Go 1.9.3 golang/go#23392
@adamdecaf reported that net/url.Parse accepts URLs with userinfo components containing just about anything (newlines and random non-ASCII Unicode).
This could be a security problem if people use the resulting URL.User.Username & Password without further validation.
The text was updated successfully, but these errors were encountered: