diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2020-04-24 22:35:48 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-24 15:53:41 -0700 |
commit | f52b0cb4184362b2f88ebbf9ea20016914ce469d (patch) | |
tree | 7ef5cb5d34f1ba4b7a049cca796fe257683b57ba /git-gui | |
parent | Git 2.26.2 (diff) | |
download | tgif-f52b0cb4184362b2f88ebbf9ea20016914ce469d.tar.xz |
credential: optionally allow partial URLs in credential_from_url_gently()
Prior to the fixes for CVE-2020-11008, we were _very_ lenient in what we
required from a URL in order to parse it into a `struct credential`.
That led to serious vulnerabilities.
There was one call site, though, that really needed that leniency: when
parsing config settings a la `credential.dev.azure.com.useHTTPPath`.
Settings like this might be desired when users want to use, say, a given
user name on a given host, regardless of the protocol to be used.
In preparation for fixing that bug, let's refactor the code to
optionally allow for partial URLs. For the moment, this functionality is
only exposed via the now-renamed function `credential_from_url_1()`, but
it is not used. The intention is to make it easier to verify that this
commit does not change the existing behavior unless explicitly allowing
for partial URLs.
Please note that this patch does more than just reinstating a way to
imitate the behavior before those CVE-2020-11008 fixes: Before that, we
would simply ignore URLs without a protocol. In other words,
misleadingly, the following setting would be applied to _all_ URLs:
[credential "example.com"]
username = that-me
The obvious intention is to match the host name only. With this patch,
we allow precisely that: when parsing the URL with non-zero
`allow_partial_url`, we do not simply return success if there was no
protocol, but we simply leave the protocol unset and continue parsing
the URL.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-gui')
0 files changed, 0 insertions, 0 deletions