project set works for invalid properties

Bug #1558690 reported by Matthew Edmonds
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Won't Fix
Undecided
Unassigned
python-openstackclient
Fix Released
Undecided
QiangTang

Bug Description

openstack project set accepts invalid properties, and even somehow sets their values

# openstack project set ABC --property xyz=pqr
# openstack project show ABC
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | |
| domain_id | ef8acb82bebd4c4abdc6b2056440b596 |
| enabled | True |
| id | 315700c2a1384b1ca21543504e3513bb |
| is_domain | False |
| name | ABC |
| xyz | pqr |
+-------------+----------------------------------+

As seen above, the new "xyz" field was created with the specified value. This is not a valid property and should not have been created.

Also, specifying an invalid property without a value did not return an error:

# openstack project set ABC --property QQQ
# openstack project show ABC
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | |
| domain_id | ef8acb82bebd4c4abdc6b2056440b596 |
| enabled | True |
| id | 315700c2a1384b1ca21543504e3513bb |
| is_domain | False |
| name | ABC |
| xyz | pqr |
+-------------+----------------------------------+

openstackclient version = 1.5.0
keystone version = mitaka

Revision history for this message
Boris Bobrov (bbobrov) wrote :

This happens because of `extras` i guess.

description: updated
Revision history for this message
Steve Martinelli (stevemar) wrote :

Yeah, it happens because of "extras" like storing email for users.

From an OSC perspective we set this as "properties" or "metadata".

For keystone, this depends on the backend, it's allowed in SQL, less so in LDAP (but that's deprecated anyway).

I don't think we can restrict this, a lot of folks use the extra fields to store data for users/groups/projects/domains (I think these are the only bits that have the "extra" attribute).

Revision history for this message
Matthew Edmonds (edmondsw) wrote :

What about how you can specify a property with no value and it doesn't do anything (that I can tell) but also doesn't return an error?

Revision history for this message
Steve Martinelli (stevemar) wrote :

via the cli? osc should catch that.. it should prevent passing in properties that don't have values

Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

This is a "feature" (i use that term loosely) in keystone (the extras field), changing behavior at this point is not in scope. Fixing things at the CLI to be more friendly might be doable.

Marked as wont fix because this is not something we can change behavior on.

Changed in keystone:
status: New → Won't Fix
QiangTang (qtang)
Changed in python-openstackclient:
assignee: nobody → QiangTang (qtang)
Revision history for this message
QiangTang (qtang) wrote :

I find a little thing when I try to set the property with
openstack project set Test --property ''=''

Then get the result like when show the project:
...
| properties | ='' |

The ''(None) key with the value ''

Is this work by design or an issue?

Revision history for this message
QiangTang (qtang) wrote :

openstack project set Test --property =c

will get:

| properties | ='c' |

Revision history for this message
QiangTang (qtang) wrote :

openstack project set Test --property =

result:
...
| properties | ='' |

Are the above status all work by design?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to osc-lib (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/345305

QiangTang (qtang)
Changed in python-openstackclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to osc-lib (master)

Reviewed: https://review.openstack.org/345305
Committed: https://git.openstack.org/cgit/openstack/osc-lib/commit/?id=7dbc92b5215c0ee3608d2341c7d60af43db9a3d6
Submitter: Jenkins
Branch: master

commit 7dbc92b5215c0ee3608d2341c7d60af43db9a3d6
Author: qtang <email address hidden>
Date: Thu Jul 21 18:06:35 2016 +0800

    Prevent null key setting for property

    null key is the invalid input when setting property
    in the openstack components.

    Prevent null key setting for property in
    openstackclient.

    Change-Id: I8ec72664b5393ffef71fffa4bd1cd3c303e86a52
    Related-Bug: #1558690

Revision history for this message
QiangTang (qtang) wrote :

Hi Matthew,

Seems in current stage, the input without the '=' will be ignored silently from the
command-line site by each openstack component when setting the property key=value pair.

We fix this issue on the osc-lib site first to prevent null key set in property.

Do you have any more comments for this bug?

Thanks,
Qiang

QiangTang (qtang)
Changed in python-openstackclient:
status: In Progress → Fix Released
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.