Skip to content

Commit

Permalink
Strip out Traceback from HTTP response
Browse files Browse the repository at this point in the history
We should not let stack traces leak to the REST API users

Fixes LP# 1103324
Fixes LP# 1092610

Change-Id: Ic1208bfeb7d44e672f8b8d3a4004a9802c14e7b9
  • Loading branch information
Davanum Srinivas committed Jan 26, 2013
1 parent 2f97345 commit fa52cb0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nova/api/openstack/wsgi.py
Expand Up @@ -1182,10 +1182,18 @@ def __call__(self, req):
# Replace the body with fault details.
code = self.wrapped_exc.status_int
fault_name = self._fault_names.get(code, "computeFault")
explanation = self.wrapped_exc.explanation
offset = explanation.find("Traceback")
if offset is not -1:
LOG.debug(_("API request failed, fault raised to the top of"
" the stack. Detailed stacktrace %s") %
explanation)
explanation = explanation[0:offset - 1]

fault_data = {
fault_name: {
'code': code,
'message': self.wrapped_exc.explanation}}
'message': explanation}}
if code == 413:
retry = self.wrapped_exc.headers.get('Retry-After', None)
if retry:
Expand Down

0 comments on commit fa52cb0

Please sign in to comment.