Skip to content

Commit 409d24f

Browse files
glandiumgitster
authored andcommitted
connect: actively reject git:// urls with a user part
Currently, urls of the for git://user@host don't work because user@host is not resolving at the DNS level, but we shouldn't be relying on it being an invalid host name, and actively reject it for containing a username in the first place. Signed-off-by: Mike Hommey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a82d1f7 commit 409d24f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

connect.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ struct child_process *git_connect(int fd[2], const char *url,
730730
const char *colon = strchr(host, ':');
731731
char *override_vhost = getenv("GIT_OVERRIDE_VIRTUAL_HOST");
732732

733+
if (user)
734+
die("user@host is not allowed in git:// urls");
735+
733736
/* If the host contains a colon (ipv6 address), it needs to
734737
* be enclosed with square brackets. */
735738
if (colon)

0 commit comments

Comments
 (0)