← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1746202] Re: Invalid query parameter could lead to HTTP 500

 

Reviewed:  https://review.openstack.org/539406
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=bf1998898453f208882a95bf88cd157274e7dbf1
Submitter: Zuul
Branch:    master

commit bf1998898453f208882a95bf88cd157274e7dbf1
Author: zhongjun <jun.zhongjun@xxxxxxxxxx>
Date:   Wed Jan 31 11:02:44 2018 +0800

    Fix UnicodeDecodeError when decode API input
    
    Convert UnicodeDecodeError to HTTPBadRequest in
    FaultWrapper.
    
    Change-Id: I826f05084b0a0ef170ef293d382868409b96ed3d
    Closes-Bug: #1746202


** Changed in: manila
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1746202

Title:
  Invalid query parameter could lead to HTTP 500

Status in Cinder:
  In Progress
Status in Manila:
  Fix Released
Status in OpenStack Compute (nova):
  In Progress

Bug description:
  Invalid query parameter could lead to HTTP 500, although Nova used JSON Schema verification
  to check input query params, but query like:
  GET /servers?limit=%88 will still lead to HTTP 500, as it failed to parse at webob which is
  pre JSON Schema check.

  GET http://10.76.150.18/compute/v2.1/servers/detail?limit=%88

  Response:

  {
      "computeFault": {
          "message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.UnicodeDecodeError'>",
          "code": 500
      }
  }

  Traceback:

  DEBUG nova.api.openstack.wsgi [None req-ee355759-13c3-4f63-a41f-920d7385878d admin admin] Calling method '<bound method ServersController.detail of <nova.api.openstack.compute.servers.ServersController object at 0x
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi [None req-ee355759-13c3-4f63-a41f-920d7385878d admin admin] Unexpected exception in API method: UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byt
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi Traceback (most recent call last):
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 803, in wrapped
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     return f(*args, **kwargs)
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/opt/stack/nova/nova/api/validation/__init__.py", line 171, in wrapper
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     req.GET.dict_of_lists(),
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 833, in GET
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     vars = GetDict(data, env)
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/usr/local/lib/python2.7/dist-packages/webob/multidict.py", line 287, in __init__
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     MultiDict.__init__(self, data)
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/usr/local/lib/python2.7/dist-packages/webob/multidict.py", line 38, in __init__
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     items = list(args[0])
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/usr/local/lib/python2.7/dist-packages/webob/compat.py", line 126, in parse_qsl_text
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     yield (x.decode(encoding), y.decode(encoding))
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi   File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi     return codecs.utf_8_decode(input, errors, True)
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: ERROR nova.api.openstack.wsgi 
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: INFO nova.api.openstack.wsgi [None req-ee355759-13c3-4f63-a41f-920d7385878d admin admin] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API lo
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: <type 'exceptions.UnicodeDecodeError'>
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: DEBUG nova.api.openstack.wsgi [None req-ee355759-13c3-4f63-a41f-920d7385878d admin admin] Returning 500 to user: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API l
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: <type 'exceptions.UnicodeDecodeError'> {{(pid=4377) __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1079}}
  Jan 30 17:46:56 kevin-dev devstack@n-api.service[4374]: INFO nova.api.openstack.requestlog [None req-ee355759-13c3-4f63-a41f-920d7385878d admin admin] 10.8.4.18 "GET /compute/v2.1/servers/detail?limit=%89" status: 500 len: 202 microversion: 2.49 time: 0.531050

To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1746202/+subscriptions


References