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

GitHub SSH URLs interpret numerical usernames as ports #102

Closed
Mr-Wallet opened this issue Oct 8, 2019 · 0 comments · Fixed by #138 · 4 remaining pull requests
Closed

GitHub SSH URLs interpret numerical usernames as ports #102

Mr-Wallet opened this issue Oct 8, 2019 · 0 comments · Fixed by #138 · 4 remaining pull requests

Comments

@Mr-Wallet
Copy link

Not sure what to do about this one...

A typical github.com SSH url is something like git@github.com:user/repo.git. If the user is a number, then it gets parsed as a port. The problem is that GitHub has users whose names are just numbers.

Parsing that number as a port makes sense in every context unless we know that it's a GitHub (or GitHub Enterprise) URL. GitHub doesn't allow SSH over any port except 22, and GitHub Enterprise doesn't either (it's not configurable by the admin). They probably do this specifically to avoid this issue; if the port can't be anything but 22, then the URL format is no longer ambiguous; that thing after a colon is always a user name.

Not sure what to do about this. For github.com you could probably add a bunch of logic to git-url-parse after you get it back from git-up and see that the domain is github.com... it would involve doing really heavy surgery on the object to fix it up, but it's technically possible. That doesn't solve the problem for Enterprise URLs though, and I don't see how that's solvable without being able to pass options to git-url-parse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment