Comment 8 for bug 1605444

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

So the issue here is that the glanceclient lets you use an empty string as the key for a user-specified image property.

Such properties are optional in the API, but they are enabled by default [0], so we should probably assume that most deployments allow them.

The value of an additionalProperty must be a string type; we don't have any restriction on length (neither maxLength or minLength) [1]. But, what we're talking about here is the *key*, and JSON schema doesn't give you a way to put restrictions on those.

The JSON standard says, basically, that an object contains members that consist of a pair (or of a pair, members sequence) and a pair is string : value. The standard says: "A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes" [2]. Since the v2 API uses JSON as its serialization format, I think we're stuck with allowing an empty string as the name of a user-specifiable property.

The glanceclient allows you to create such an image property, but it also allows you to delete it. So I don't think this is really a bug. It's a little weird, but not a bug.

You can also create, update, and delete a user-specified property with an empty string as the name using the API directly. Since our goal is to keep the API and glanceclient in sync as much as possible, that's another reason to invalidate this bug.

[0] https://github.com/openstack/glance/blob/d64fe8bd1bbd4be73201d4f652e16e9d47ff39d1/glance/common/config.py#L174-L196

[1] https://github.com/openstack/glance/blob/d64fe8bd1bbd4be73201d4f652e16e9d47ff39d1/glance/schema.py#L118

[2] http://www.json.org/