Trove API Validation Disallows Wildcards in User Host
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack DBaaS (Trove) |
Confirmed
|
Low
|
Unassigned |
Bug Description
[Description]
https:/
The user's host is validated against the non_empty_
non_empty_string = {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^.*[0-
}
Previous to this commit, the --host flag was optional (it would conveniently default to '%'). This behavior has been broken, as well as the ability to include wildcards (via % and _).
Per http://
Note: If it was decided that defaulting the host was in poor taste, then the CLI should enforce the host argument (to be consistent) (see https:/
[Example]
$ trove-cli user create --id 4a91d343-
...
BODY: {
"users": [
{
{
}
],
"host": "%",
"name": "myuser",
}
]
}
RESPONSE HEADERS: {'date': 'Tue, 09 Jul 2013 01:04:29 GMT', 'status': '400', 'content-length': '102', 'content-type': 'application/json; charset=UTF-8'}
RESPONSE BODY : {
"badRequest": {
"code": 400,
"message": "Validation error: u'%' does not match '^.*[0-
}
}
Validation error: u'%' does not match '^.*[0-
description: | updated |
Changed in trove: | |
status: | New → Confirmed |
importance: | Undecided → Critical |
assignee: | nobody → Riddhi (ridhi-j-shah) |
milestone: | none → havana-2 |
Changed in trove: | |
status: | Fix Committed → Fix Released |
Changed in trove: | |
milestone: | havana-2 → 2013.2 |
Changed in trove: | |
status: | Fix Committed → Triaged |
milestone: | 2013.2 → icehouse-3 |
Changed in trove: | |
assignee: | nobody → Sushil Kumar (sushil-kumar2) |
Changed in trove: | |
milestone: | icehouse-3 → next |
milestone: | next → icehouse-rc1 |
Changed in trove: | |
importance: | Critical → Medium |
milestone: | icehouse-rc1 → next |
Changed in trove: | |
milestone: | next → juno-1 |
Changed in trove: | |
milestone: | juno-2 → juno-3 |
Changed in trove: | |
milestone: | juno-3 → next |
Changed in trove: | |
status: | In Progress → Confirmed |
assignee: | Sushil Kumar (sushil-kumar2) → nobody |
It looks like there was existing validation for the host in MySQLUser (See https:/ /github. com/openstack/ trove/blob/ master/ trove/guestagen t/db/models. py#L350)
I imagine that once the regexps in trove/common/ apischema. py are fixed for password + host + user, that is_valid + is_valid_user + is_valid_host_name are semi-redundant.
If you want to take it a step further, you could also take a look at MySQLDatabase and fix the inconsistencies there (ex: name has a check for > 64 chars, yet apischema.py permits 255, charset checks, etc.)