Skip to content

Commit 17a0278

Browse files
committed
Git 2.23.2
Signed-off-by: Junio C Hamano <[email protected]>
2 parents a7312d1 + 69fab82 commit 17a0278

15 files changed

+147
-7
lines changed

Documentation/RelNotes/2.17.4.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Git v2.17.4 Release Notes
2+
=========================
3+
4+
This release is to address the security issue: CVE-2020-5260
5+
6+
Fixes since v2.17.3
7+
-------------------
8+
9+
* With a crafted URL that contains a newline in it, the credential
10+
helper machinery can be fooled to give credential information for
11+
a wrong host. The attack has been made impossible by forbidding
12+
a newline character in any value passed via the credential
13+
protocol.
14+
15+
Credit for finding the vulnerability goes to Felix Wilhelm of Google
16+
Project Zero.

Documentation/RelNotes/2.18.3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.18.3 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.4; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.19.4.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.19.4 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.4; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.20.3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.20.3 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.4; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.21.2.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.21.2 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.4; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.22.3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.22.3 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.4; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.23.2.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.23.2 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.4; see
5+
the release notes for that version for details.

GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=v2.23.1
4+
DEF_VER=v2.23.2
55

66
LF='
77
'

RelNotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Documentation/RelNotes/2.23.1.txt
1+
Documentation/RelNotes/2.23.2.txt

credential.c

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ static void credential_write_item(FILE *fp, const char *key, const char *value)
195195
{
196196
if (!value)
197197
return;
198+
if (strchr(value, '\n'))
199+
die("credential value for %s contains newline", key);
198200
fprintf(fp, "%s=%s\n", key, value);
199201
}
200202

@@ -322,7 +324,22 @@ void credential_reject(struct credential *c)
322324
c->approved = 0;
323325
}
324326

325-
void credential_from_url(struct credential *c, const char *url)
327+
static int check_url_component(const char *url, int quiet,
328+
const char *name, const char *value)
329+
{
330+
if (!value)
331+
return 0;
332+
if (!strchr(value, '\n'))
333+
return 0;
334+
335+
if (!quiet)
336+
warning(_("url contains a newline in its %s component: %s"),
337+
name, url);
338+
return -1;
339+
}
340+
341+
int credential_from_url_gently(struct credential *c, const char *url,
342+
int quiet)
326343
{
327344
const char *at, *colon, *cp, *slash, *host, *proto_end;
328345

@@ -336,7 +353,7 @@ void credential_from_url(struct credential *c, const char *url)
336353
*/
337354
proto_end = strstr(url, "://");
338355
if (!proto_end)
339-
return;
356+
return 0;
340357
cp = proto_end + 3;
341358
at = strchr(cp, '@');
342359
colon = strchr(cp, ':');
@@ -371,4 +388,21 @@ void credential_from_url(struct credential *c, const char *url)
371388
while (p > c->path && *p == '/')
372389
*p-- = '\0';
373390
}
391+
392+
if (check_url_component(url, quiet, "username", c->username) < 0 ||
393+
check_url_component(url, quiet, "password", c->password) < 0 ||
394+
check_url_component(url, quiet, "protocol", c->protocol) < 0 ||
395+
check_url_component(url, quiet, "host", c->host) < 0 ||
396+
check_url_component(url, quiet, "path", c->path) < 0)
397+
return -1;
398+
399+
return 0;
400+
}
401+
402+
void credential_from_url(struct credential *c, const char *url)
403+
{
404+
if (credential_from_url_gently(c, url, 0) < 0) {
405+
warning(_("skipping credential lookup for url: %s"), url);
406+
credential_clear(c);
407+
}
374408
}

0 commit comments

Comments
 (0)