components/openstack/nova/patches/12-cve-2017-7214.patch
author Drew Fisher <drew.fisher@oracle.com>
Thu, 23 Mar 2017 16:36:09 +0000
branchs11u3-sru
changeset 7872 aa4e61b4b594
permissions -rw-r--r--
25772305 problem in SERVICE/NOVA
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7872
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     1
Upstream patch to address CVE-2017-7214.  We assume 'circural' below
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     2
is a typo for 'circular' but we took the comment verbatim from
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     3
upstream.  This patch is modified slightly to work with OpenStack Kilo
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     4
which is EOL'd upstream.
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     5
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     6
From 305cdb38db47258909ef83d5918c7c85ef9d7a5b Mon Sep 17 00:00:00 2001
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     7
From: Balazs Gibizer <[email protected]>
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     8
Date: Fri, 17 Mar 2017 11:24:49 +0100
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
     9
Subject: [PATCH] do not include context to exception notification
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    10
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    11
The wrap_exception decorator optionally emited a notification.
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    12
Based on the code comments the original intention was not to include the
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    13
context to that notification due to security reasons. However the
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    14
implementation did included the context to the payload of the legacy
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    15
notification.
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    16
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    17
Recently we saw circural reference errors during the payload serialization
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    18
of this notification. Based on the logs the only complex data structure
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    19
that could cause circural reference is the context. So this patch
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    20
removes the context from the legacy exception notification.
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    21
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    22
The versioned exception notification is not affected as it does not
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    23
contain the args of the decorated function.
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    24
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    25
Closes-Bug: #1673375
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    26
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    27
--- nova-2015.1.2/nova/exception.py.orig	2017-03-23 16:30:19.897009405 +0000
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    28
+++ nova-2015.1.2/nova/exception.py	2017-03-23 16:33:57.530985808 +0000
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    29
@@ -75,6 +75,10 @@ def wrap_exception(notifier=None, get_no
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    30
                         payload = dict(exception=e)
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    31
                         call_dict = safe_utils.getcallargs(f, context,
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    32
                                                            *args, **kw)
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    33
+                        # NOTE(gibi) remove context as well as it contains
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    34
+                        # sensitive information and it can also contain
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    35
+                        # circular references
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    36
+                        call_dict.pop('context', None)
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    37
                         cleansed = _cleanse_dict(call_dict)
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    38
                         payload.update({'args': cleansed})
aa4e61b4b594 25772305 problem in SERVICE/NOVA
Drew Fisher <drew.fisher@oracle.com>
parents:
diff changeset
    39