Updating the server with invalid name is not raising Bad request

Bug #944034 reported by Rajalakshmi Ganesan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Low
Mike Lundy

Bug Description

Description:
----------------
Updating the server with invalid name should raise the bad request exception. But it is not raising.

Expected result:
-----------------------
Should raise the bad request

Refernce link:
------------------
http://docs.openstack.org/api/openstack-compute/1.1/content/ServerUpdate.html

Changed in nova:
status: New → Triaged
importance: Undecided → Low
tags: added: low-hanging-fruit
Mike Lundy (novas0x2a)
Changed in nova:
assignee: nobody → Mike Lundy (novas0x2a)
Revision history for this message
Mike Lundy (novas0x2a) wrote :

submitter: what invalid name do you mean?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/4787

Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/4787
Committed: http://github.com/openstack/nova/commit/27013e87f53cccbfd2e203f065e416437ba08987
Submitter: Jenkins
Branch: master

commit 27013e87f53cccbfd2e203f065e416437ba08987
Author: Mike Lundy <email address hidden>
Date: Fri Mar 2 00:15:04 2012 +0000

    Fail gracefully when the db doesn't speak unicode

    When sqlalchemy/mysql doesn't contain the charset=utf8 or use_unicode=1
    parameters (and the default mysql connection charset is not utf8),
    sqlalchemy will connect to mysql in ascii mode; In ascii mode, it will
    attempt to reencode all input data to latin-1 regardless of the
    database/table collation setting. This catches that error and turns it
    into an invalid parameter.

    (The error message associated with this is something like
    UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2026' in
    position 30: ordinal not in range(256))

    This fixes bug 944034 and is related to bug 898808

    Change-Id: I082b7568ef9e9d2104e13aa58d207535ef201bd3

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → essex-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-rc1 → 2012.1
Revision history for this message
Rajalakshmi Ganesan (rajalakshmi-ganesan) wrote :
Download full text (9.2 KiB)

I am still able to update servers name with invalid charcaters such ad "&!@#$%^&*()+_"

Thus reopening this bug.

LOG:-
------------

[umamaheshk@HPOpenstackVM16 ~/source/csbu-qa-dev/nova/tests]$nova list
+--------------------------------------+-----------------------------------+--------+------------------+
| ID | Name | Status | Networks |
+--------------------------------------+-----------------------------------+--------+------------------+
| 16716a61-d8ba-4abb-885d-db10eced1562 | update_server_name | ACTIVE | private=10.0.0.4 |
| a31aeecd-5237-4e1a-98b1-407164166c3a | test-1 | ACTIVE | private=10.0.0.5 |
| d496dc20-ef69-4aa6-97c0-798878b635c8 | update_server_name&12!@#$%^&*()+_ | ACTIVE | private=10.0.0.3 |
+--------------------------------------+-----------------------------------+--------+------------------+
[umamaheshk@HPOpenstackVM16 ~/source/csbu-qa-dev/nova/tests]$export NOVACLIENT_DEBUG=1
[umamaheshk@HPOpenstackVM16 ~/source/csbu-qa-dev/nova/tests]$./apitool.py -j update.json PUT /servers/a31aeecd-5237-4e1a-98b1-407164166c3a
REQ: curl -i http://10.233.52.237:5000/v2.0/tokens -X POST -H "Content-Type: application/json" -H "User-Agent: python-novaclient"

REQ BODY: {"auth": {"tenantName": "admin", "passwordCredentials": {"username": "admin", "password": "muralik"}}}

RESP:{'date': 'Fri, 12 Oct 2012 14:16:10 GMT', 'vary': 'X-Auth-Token', 'content-length': '2462', 'status': '200', 'content-type': 'application/json'} {"access": {"token": {"expires": "2012-10-13T14:16:10Z", "id": "0672b716683d4f21a4e46ad8846cc34c", "tenant": {"enabled": true, "description": null, "name": "admin", "id": "bea2e6e7c6d4468281b37f0281d90a65"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://10.233.52.237:8774/v2/bea2e6e7c6d4468281b37f0281d90a65", "region": "RegionOne", "internalURL": "http://10.233.52.237:8774/v2/bea2e6e7c6d4468281b37f0281d90a65", "id": "4d2bd52566f449b681d138970d0551a9", "publicURL": "http://10.233.52.237:8774/v2/bea2e6e7c6d4468281b37f0281d90a65"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://10.233.52.237:3333", "region": "RegionOne", "internalURL": "http://10.233.52.237:3333", "id": "96a896eefefd435d9eb171f5193f6ffc", "publicURL": "http://10.233.52.237:3333"}], "endpoints_links": [], "type": "s3", "name": "s3"}, {"endpoints": [{"adminURL": "http://10.233.52.237:9292", "region": "RegionOne", "internalURL": "http://10.233.52.237:9292", "id": "3744aa8ba7e444d4bc88e92edce85336", "publicURL": "http://10.233.52.237:9292"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://10.233.52.237:8776/v1/bea2e6e7c6d4468281b37f0281d90a65", "region": "RegionOne", "internalURL": "http://10.233.52.237:8776/v1/bea2e6e7c6d4468281b37f0281d90a65", "id": "40062dde5eef4d7091d8d2e034cc3858", "publicURL": "http://10.233.52.237:8776/v1/bea2e6e7c6d4468281b37f0281d90a65"}], "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints": [{"adminURL": "http://10.233.52.237:8773/services/Admin", "region": "RegionOne", "internalURL": "http://10.2...

Read more...

Changed in nova:
status: Fix Released → New
status: New → In Progress
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

There's nothing in the doc [1] that says characters in "&!@#$%^&*()+_" are invalid. we throw Bad Request only under the following conditions [2]

[1] http://docs.openstack.org/api/openstack-compute/1.1/content/ServerUpdate.html
[2] validation code
-------------------------------------------------------------------------------------
    def _validate_server_name(self, value):
        if not isinstance(value, basestring):
            msg = _("Server name is not a string or unicode")
            raise exc.HTTPBadRequest(explanation=msg)

        if not value.strip():
            msg = _("Server name is an empty string")
            raise exc.HTTPBadRequest(explanation=msg)

        if not len(value) < 256:
            msg = _("Server name must be less than 256 characters.")
            raise exc.HTTPBadRequest(explanation=msg)
-------------------------------------------------------------------------------------

Changed in nova:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.