do not include context to exception notification
The wrap_exception decorator optionally emited a notification. Based on the code comments the original intention was not to include the context to that notification due to security reasons. However the implementation did included the context to the payload of the legacy notification. Recently we saw circural reference errors during the payload serialization of this notification. Based on the logs the only complex data structure that could cause circural reference is the context. So this patch removes the context from the legacy exception notification. The versioned exception notification is not affected as it does not contain the args of the decorated function. Conflicts: nova/exception_wrapper.py nova/tests/unit/test_exception.py NOTE(mriedem): The conflict is due to some refactor in Newton:6329d721ef
Closes-Bug: #1673375 Change-Id: I1d217620e52d45595a3e0e49ed57b4ab33cd1688 (cherry picked from commit3bf177a59c
) (cherry picked from commita8a1915456
) (cherry picked from commitd0ee248bab
)
This commit is contained in:
parent
d27c1b0fd3
commit
305cdb38db
@ -97,6 +97,10 @@ def wrap_exception(notifier=None, get_notifier=None):
|
|||||||
# self can't be serialized and shouldn't be in the
|
# self can't be serialized and shouldn't be in the
|
||||||
# payload
|
# payload
|
||||||
call_dict.pop('self', None)
|
call_dict.pop('self', None)
|
||||||
|
# NOTE(gibi) remove context as well as it contains
|
||||||
|
# sensitive information and it can also contain
|
||||||
|
# circular references
|
||||||
|
call_dict.pop('context', None)
|
||||||
cleansed = _cleanse_dict(call_dict)
|
cleansed = _cleanse_dict(call_dict)
|
||||||
payload.update({'args': cleansed})
|
payload.update({'args': cleansed})
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ class WrapExceptionTestCase(test.NoDBTestCase):
|
|||||||
self.assertEqual(3, notifier.provided_payload['args']['extra'])
|
self.assertEqual(3, notifier.provided_payload['args']['extra'])
|
||||||
for key in ['exception', 'args']:
|
for key in ['exception', 'args']:
|
||||||
self.assertIn(key, notifier.provided_payload.keys())
|
self.assertIn(key, notifier.provided_payload.keys())
|
||||||
|
self.assertNotIn('context', notifier.provided_payload['args'].keys())
|
||||||
|
|
||||||
|
|
||||||
class NovaExceptionTestCase(test.NoDBTestCase):
|
class NovaExceptionTestCase(test.NoDBTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user