summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorLi Zhou <li.zhou@windriver.com>2020-04-21 16:18:04 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-05-07 17:32:09 +0100
commitcfcd63e044c66b22fcddcbd55df0c2316fe06051 (patch)
tree944bc88c66f39dfcd48af2a1c7c2ac72cd2ed1c2 /meta
parent9f70721b9a25de908e5dc874f11d5708447a5e9d (diff)
downloadpoky-cfcd63e044c66b22fcddcbd55df0c2316fe06051.tar.gz
git: Security Advisory - git - CVE-2020-5260
Backport patch from <https://github.com/git/git/commit/ 9a6bbee8006c24b46a85d29e7b38cfa79e9ab21b> to solve CVE-2020-5260. (From OE-Core rev: e4c3adbaae41147f921dde638b25911d1f5422e1) Signed-off-by: Li Zhou <li.zhou@windriver.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/git/git.inc4
-rw-r--r--meta/recipes-devtools/git/git/CVE-2020-5260.patch65
2 files changed, 68 insertions, 1 deletions
diff --git a/meta/recipes-devtools/git/git.inc b/meta/recipes-devtools/git/git.inc
index 6e137432f0..176423e972 100644
--- a/meta/recipes-devtools/git/git.inc
+++ b/meta/recipes-devtools/git/git.inc
@@ -7,7 +7,9 @@ DEPENDS = "openssl curl zlib expat"
7PROVIDES_append_class-native = " git-replacement-native" 7PROVIDES_append_class-native = " git-replacement-native"
8 8
9SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ 9SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
10 ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages" 10 ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages \
11 file://CVE-2020-5260.patch \
12 "
11 13
12S = "${WORKDIR}/git-${PV}" 14S = "${WORKDIR}/git-${PV}"
13 15
diff --git a/meta/recipes-devtools/git/git/CVE-2020-5260.patch b/meta/recipes-devtools/git/git/CVE-2020-5260.patch
new file mode 100644
index 0000000000..d03e701a8f
--- /dev/null
+++ b/meta/recipes-devtools/git/git/CVE-2020-5260.patch
@@ -0,0 +1,65 @@
1From 9a6bbee8006c24b46a85d29e7b38cfa79e9ab21b Mon Sep 17 00:00:00 2001
2From: Jeff King <peff@peff.net>
3Date: Wed, 11 Mar 2020 17:53:41 -0400
4Subject: [PATCH] credential: avoid writing values with newlines
5
6The credential protocol that we use to speak to helpers can't represent
7values with newlines in them. This was an intentional design choice to
8keep the protocol simple, since none of the values we pass should
9generally have newlines.
10
11However, if we _do_ encounter a newline in a value, we blindly transmit
12it in credential_write(). Such values may break the protocol syntax, or
13worse, inject new valid lines into the protocol stream.
14
15The most likely way for a newline to end up in a credential struct is by
16decoding a URL with a percent-encoded newline. However, since the bug
17occurs at the moment we write the value to the protocol, we'll catch it
18there. That should leave no possibility of accidentally missing a code
19path that can trigger the problem.
20
21At this level of the code we have little choice but to die(). However,
22since we'd not ever expect to see this case outside of a malicious URL,
23that's an acceptable outcome.
24
25Reported-by: Felix Wilhelm <fwilhelm@google.com>
26
27Upstream-Status: Backport
28CVE: CVE-2020-5260
29Signed-off-by: Li Zhou <li.zhou@windriver.com>
30---
31 credential.c | 2 ++
32 t/t0300-credentials.sh | 6 ++++++
33 2 files changed, 8 insertions(+)
34
35diff --git a/credential.c b/credential.c
36index 9747f47..00ee4d6 100644
37--- a/credential.c
38+++ b/credential.c
39@@ -194,6 +194,8 @@ static void credential_write_item(FILE *fp, const char *key, const char *value)
40 {
41 if (!value)
42 return;
43+ if (strchr(value, '\n'))
44+ die("credential value for %s contains newline", key);
45 fprintf(fp, "%s=%s\n", key, value);
46 }
47
48diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
49index 03bd31e..15cc3c5 100755
50--- a/t/t0300-credentials.sh
51+++ b/t/t0300-credentials.sh
52@@ -309,4 +309,10 @@ test_expect_success 'empty helper spec resets helper list' '
53 EOF
54 '
55
56+test_expect_success 'url parser rejects embedded newlines' '
57+ test_must_fail git credential fill <<-\EOF
58+ url=https://one.example.com?%0ahost=two.example.com/
59+ EOF
60+'
61+
62 test_done
63--
641.9.1
65