← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1240458] Re: should validate the parameters of agent API

 

** Changed in: nova
       Status: Fix Committed => 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/1240458

Title:
  should validate the parameters of agent API

Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  The agent API has some parameters, but they are not validated.
  Each parameter is stored to the table "agent_builds", and each column is defined as varchar(255).

  mysql> desc agent_builds;
      +--------------+--------------+------+-----+---------+----------------+
      | Field        | Type         | Null | Key | Default | Extra          |
      +--------------+--------------+------+-----+---------+----------------+
      | created_at   | datetime     | YES  |     | NULL    |                |
      | updated_at   | datetime     | YES  |     | NULL    |                |
      | deleted_at   | datetime     | YES  |     | NULL    |                |
      | id           | int(11)      | NO   | PRI | NULL    | auto_increment |
      | hypervisor   | varchar(255) | YES  | MUL | NULL    |                |
      | os           | varchar(255) | YES  |     | NULL    |                |
      | architecture | varchar(255) | YES  |     | NULL    |                |
      | version      | varchar(255) | YES  |     | NULL    |                |
      | url          | varchar(255) | YES  |     | NULL    |                |
      | md5hash      | varchar(255) | YES  |     | NULL    |                |
      | deleted      | int(11)      | YES  |     | NULL    |                |
      +--------------+--------------+------+-----+---------+----------------+

  Due to this fact, if specifying very long characters as a parameter,
  the stored data is truncated like the following:

  $ nova agent-create os arch 1 url hash 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
  [..]
  $
  $ $ nova agent-list
  +----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----+--------------+---------+---------+-----+
  | Agent_id | Hypervisor                                                                                                                                                                                                                                                      | OS | Architecture | Version | Md5hash | Url |
  +----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----+--------------+---------+---------+-----+
  | 1        | 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234 | os | arch         | 1       | hash    | url |
  +----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----+--------------+---------+---------+-----+
  $

  so the parameters should be validated before storing to DB.

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