Subject: Re: [PATCH] urlmatch: create fetch.credentialsInUrl config

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 May 2022 14:14:06 -0700

Derrick Stolee <[email-masked]> writes:

> This computation of at_ptr matches the one in url_normalize_1(),
> so it at least agrees about where the "username[:password]" section
> could be.

OK.

> That does mean that the password cannot contain an "@"
> symbol (unless it is special-cased somehow?).

I wasn't worried about what is valid but more about what attackers
can fool users to throw at "git clone" and make our code misbehave
(which can include garbage that would not parse correctly).

I think the while() loop will just become a no-op, anonymized buffer
is left empty and colon_ptr does not get updated at all.  Then
strbuf_addstr() after the loop will put everything from '@' to the
strbuf to be showed, and none of these should lead to any overrun or
exploit.

Thanks.