Creating a "key" type order without a name set in "meta" produces a null when retrieved
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Barbican |
Fix Released
|
Low
|
Juan Antonio Osorio Robles |
Bug Description
Creating a "key" type order without a name set in "meta" produces a null when retrieved. Previously we populated
this value with the UUID of the secret. The expected behavior can be seen by creating a secret without a name attribute.
Steps to Reproduce:
-------
Create the order without a name attribute in meta:
curl -X POST -H "X-Auth-
"type": "key",
"meta": {
"mode": "cbc",
"bit_length": 256,
"algorithm": "aes",
"payload_
}
}' http://
Retrieve and inspect the resulting order:
curl -X GET -H "X-Auth-
Reponse:
{
"created": "2014-10-
"meta": {
"mode": "cbc",
"name": null,
},
"order_ref": "http://
"secret_ref": "http://
"status": "ACTIVE",
"type": "key",
"updated": "2014-10-
}
Changed in barbican: | |
status: | New → Confirmed |
importance: | Undecided → Low |
milestone: | none → kilo-1 |
Changed in barbican: | |
milestone: | kilo-1 → none |
tags: | added: verified |
Changed in barbican: | |
milestone: | none → mitaka-1 |
status: | Invalid → Fix Released |
Well, is adding the uuid as the name of the secret even the correct behavior? It seems that in the database, at least for secrets, the name is stored as empty, and only when the secret it's fetched then the id is set to the 'name' attribute: when there is a secret_ model.to_ dict_fields( ) . This is actually called when fetching secrets: in the augment_ fields_ with_content_ types function. Anyway, the point is that actually the secrets do not have the name replaced by the id in the database, which means that if we try to fetch the list of secrets, and filter by using the id, it will not work.
So, if the desired behavior is to have the secrets always with some sort of name, then we could start storing the uuid when the name is empty in the database; And the same would be done for orders. If this is not what we want, then I would say we should stop returning the uuid in the 'name' field for secrets and let the behavior that the orders have be the "desired" one. Any thoughts?