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

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