-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 3/21/23 08:58, Pavlo Shchelokovskyy wrote:
Hi all,
after having some thoughts, I came to another solution, that I think is the most appropriate here, kind of a variation of option 1:
- Castellan should cleanup intermediate resources before returning
secret ID(s) to the caller
Hi Pavlo,
We discussed this issue during last week's PTG sessions [1], and we agree that this approach makes sense from a Castellan point of view.
As I see it now, the root of the problem is in castellan's BarbicanKeyManager and the way it hides implementation details from the user. Since it returns only IDs of created secrets to the user, the api caller has no notion that something else has to be deleted once it is time for this. Since Barbican API is perfectly capable to delete orders and containers without deleting the secrets they reference, this is what castellan should do just before it returns IDs of generated secrets to the API
caller.
The only small trouble is that with default 'legacy' API policies in Barbican, not everybody who can create orders can delete them.. but this can be accounted for with try..except.
I think it would make sense to update the legacy policies to allow users with the "creator" role to delete orders. This change is similar to a change we made to the Secrets policy to allow deletion by users with the "creator" role as well. [2]
Please review the patch in this regard https://review.opendev.org/c/openstack/castellan/+/877423 https://review.opendev.org/c/openstack/castellan/+/877423
Thanks for the patch, I've added it to my review queue.
Additionally, we discussed some changes we'll make to the API this cycle to hopefully make it easier to manage orders:
* Add a new API Mircoversion so we can * Add a new "genrated_by" field to the Secret and Container metadata that contains the order ID for secrets/containers that were created by an order. This would be null for secrets not created by an Order. * Cascade delete the Order when the secret or container is deleted.
We'll also be looking at the barbican-manage CLI to make sure that purging deleted secrets is working as expected.
Regards, - - Douglas Mendizábal
[1] https://etherpad.opendev.org/p/march2023-ptg-barbican [2] https://storyboard.openstack.org/#!/story/2009791