diff --git a/nova/exception_wrapper.py b/nova/exception_wrapper.py index 9898898a05f0..644da0163067 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 07f99ed1d7a1..d3ae76161627 100644 --- a/nova/tests/unit/test_exception.py +++ b/nova/tests/unit/test_exception.py @@ -91,6 +91,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]