[PATCH v7 8/9] connect: actively reject git:// urls with a user part
- From
Mike Hommey <mh@glandium.org>
- Date
- May 21, 2016, 23:17 UTC
- Message-ID
- <20160521231732.4888-9-mh@glandium.org>
- In-Reply-To
- <20160521231732.4888-1-mh@glandium.org>
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 <mh@glandium.org> --- connect.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/connect.c b/connect.c index 52d34c7..04ce210 100644 --- a/connect.c +++ b/connect.c @@ -726,6 +726,9 @@ struct child_process *git_connect(int fd[2], const char *url, const char *colon = strchr(host, ':'); char *override_vhost = getenv("GIT_OVERRIDE_VIRTUAL_HOST"); + if (user) + die("user@host is not allowed in git:// urls"); + /* If the host contains a colon (ipv6 address), it needs to * be enclosed with square brackets. */ if (colon)
-- 2.8.3.401.ga81c606.dirty