diff --git a/nova/exception_wrapper.py b/nova/exception_wrapper.py index 5b74c3b72ff4..5051b83e8878 100644 --- a/nova/exception_wrapper.py +++ b/nova/exception_wrapper.py @@ -86,6 +86,9 @@ def _get_call_dict(function, self, context, *args, **kw): # self can't be serialized and shouldn't be in the # payload 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) return _cleanse_dict(call_dict) diff --git a/nova/tests/unit/test_exception.py b/nova/tests/unit/test_exception.py index a9bada1af6fd..55478a60a930 100644 --- a/nova/tests/unit/test_exception.py +++ b/nova/tests/unit/test_exception.py @@ -61,6 +61,7 @@ class WrapExceptionTestCase(test.NoDBTestCase): self.assertEqual(3, notification.payload['args']['extra']) for key in ['exception', 'args']: self.assertIn(key, notification.payload.keys()) + self.assertNotIn('context', notification.payload['args'].keys()) self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS)) notification = fake_notifier.VERSIONED_NOTIFICATIONS[0]