Re: [PATCH v5 8/9] connect: actively reject git:// urls with a user part
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 16, 2016, 22:41 UTC
- Message-ID
- <xmqqmvnpzkvj.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160516000740.19042-9-mh@glandium.org>
Mike Hommey <mh@glandium.org> writes:
> 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.
Makes sense. Connecting to host by stripping user@ would probably give us a better behaviour, but this is a good first step even if we are aiming for that endgame state.
Show 20 quoted lines
>
> 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 df15ff3..fdd40b0 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -716,6 +716,9 @@ struct child_process *git_connect(int fd[2], const char *url,
> */
> struct strbuf target_host = STRBUF_INIT;
> char *override_vhost = getenv("GIT_OVERRIDE_VIRTUAL_HOST");
> + if (user)
> + die("user@host is not allowed in git:// urls");
> +
> if (override_vhost)
> strbuf_addstr(&target_host, override_vhost);
> else {