Blame SOURCES/libvirt-conf-Don-t-format-http-cookies-unless-VIR_DOMAIN_DEF_FORMAT_SECURE-is-used.patch

a41c76
From 898e0003ae21e9fbe49995980c8746e9d2ac9b8b Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <898e0003ae21e9fbe49995980c8746e9d2ac9b8b@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 23 Jun 2020 14:23:06 +0200
a41c76
Subject: [PATCH] conf: Don't format http cookies unless
a41c76
 VIR_DOMAIN_DEF_FORMAT_SECURE is used
a41c76
a41c76
Starting with 3b076391befc3fe72deb0c244ac6c2b4c100b410
a41c76
(v6.1.0-122-g3b076391be) we support http cookies. Since they may contain
a41c76
somewhat sensitive information we should not format them into the XML
a41c76
unless VIR_DOMAIN_DEF_FORMAT_SECURE is asserted.
a41c76
a41c76
Reported-by: Han Han <hhan@redhat.com>
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Erik Skultety <eskultet@redhat.com>
a41c76
(cherry picked from commit a5b064bf4b17a9884d7d361733737fb614ad8979)
a41c76
a41c76
CVE-2020-14301
a41c76
Message-Id: <592a0b594666f580e743b6bd2b4ddccbd1e0cc7c.1592914898.git.pkrempa@redhat.com>
a41c76
a41c76
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
---
a41c76
 src/conf/domain_conf.c | 8 ++++++--
a41c76
 1 file changed, 6 insertions(+), 2 deletions(-)
a41c76
a41c76
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
a41c76
index ed9ca0e9d8..60962ee7c1 100644
a41c76
--- a/src/conf/domain_conf.c
a41c76
+++ b/src/conf/domain_conf.c
a41c76
@@ -24377,11 +24377,15 @@ virDomainSourceDefFormatSeclabel(virBufferPtr buf,
a41c76
 
a41c76
 static void
a41c76
 virDomainDiskSourceFormatNetworkCookies(virBufferPtr buf,
a41c76
-                                        virStorageSourcePtr src)
a41c76
+                                        virStorageSourcePtr src,
a41c76
+                                        unsigned int flags)
a41c76
 {
a41c76
     g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
a41c76
     size_t i;
a41c76
 
a41c76
+    if (!(flags & VIR_DOMAIN_DEF_FORMAT_SECURE))
a41c76
+        return;
a41c76
+
a41c76
     for (i = 0; i < src->ncookies; i++) {
a41c76
         virBufferEscapeString(&childBuf, "<cookie name='%s'>", src->cookies[i]->name);
a41c76
         virBufferEscapeString(&childBuf, "%s</cookie>\n", src->cookies[i]->value);
a41c76
@@ -24442,7 +24446,7 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
a41c76
                           virTristateBoolTypeToString(src->sslverify));
a41c76
     }
a41c76
 
a41c76
-    virDomainDiskSourceFormatNetworkCookies(childBuf, src);
a41c76
+    virDomainDiskSourceFormatNetworkCookies(childBuf, src, flags);
a41c76
 
a41c76
     if (src->readahead)
a41c76
         virBufferAsprintf(childBuf, "<readahead size='%llu'/>\n", src->readahead);
a41c76
-- 
a41c76
2.27.0
a41c76