-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go/internal/get: isSecure does not parse Git repository URIs correctly #23855
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
While it uses SSH, it does not provide any encryption (https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols). So does it still qualify as being secure? |
@fraenkel I am unsure what you mean by "it does not provide any encryption" . SSH provides both authentication and encryption. The only problem here is that the URL is parsed incorrectly... it is parsed as a Git protocol URL, which is incorrect, because it is actually an SSH URL. |
I see what you mean. You are talking about when there is no scheme. Sorry for the confusion. |
Change https://golang.org/cl/155077 mentions this issue: |
The go command explicitly avoids attempting to guess what non-URLs mean. Please just use the full URL. Even though this is listed in a section titled "Git URLs" it is plainly not a URL in the sense of RFC 3986. |
You have a good point that this is not a URL in the sense of RFC 3986, but this is still a bug in go get, because go get is incorrectly claiming that an insecure protocol is being used when in fact this is not true. At a bare minimum, the error message is incorrect. |
There is no need to guess, it's documented. The term "explicitly" means to me that this is somehow documented behavior of go get, but I was unable to find any documentation for this behavior, and had to figure it out for myself. So if this behavior is intentional, it should at least be documented somewhere. |
go version go1.9.4 darwin/amd64
When Git parses a URL, it checks to see that the
:
is followed by a//
, otherwise it considers the URL to be have[user@]host:path
syntax. This is documented in the Git URLs documentation page. However,go get
cannot understand the scp-like syntax, this behavior is incorrect.is_url
in url.c:19 which shows the correct behavior, called fromtransport_get
at transport.c:828isSecure
in vcs.go:56 which shows the incorrect behaviorHere's how to reproduce:
The resulting error message is:
This is incorrect, the actual protocol here is SSH and
go get
is parsing it incorrectly. The workaround is to not have a Git server namedgit
, but isn't that the most sensible name for your Git server?The text was updated successfully, but these errors were encountered: