Trust operations in policy.json are misleading

Bug #1373599 reported by Nathan Kinder
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Unassigned

Bug Description

The sample policy.json files included in Keystone have the trust API operations listed. For example:

    "identity:create_trust": "user_id:%(trust.trustor_user_id)s",
    "identity:get_trust": "rule:admin_or_owner",
    "identity:list_trusts": "",
    "identity:list_roles_for_trust": "",
    "identity:check_role_for_trust": "",
    "identity:get_role_for_trust": "",
    "identity:delete_trust": "",

This implies that these trust operations are protected by policy, which is true but misleading. While policy does protect these operations, they are hardcoded to be very restrictive. Here are some examples from the controller code:

----------------------------------------------------------------------
    @controller.protected()
    def delete_trust(self, context, trust_id):
        trust = self.trust_api.get_trust(trust_id)
        if not trust:
            raise exception.TrustNotFound(trust_id=trust_id)

        user_id = self._get_user_id(context)
        _admin_trustor_only(context, trust, user_id)
        self.trust_api.delete_trust(trust_id)

    @controller.protected()
    def list_roles_for_trust(self, context, trust_id):
        trust = self.get_trust(context, trust_id)['trust']
        if not trust:
            raise exception.TrustNotFound(trust_id=trust_id)
        user_id = self._get_user_id(context)
        _trustor_trustee_only(trust, user_id)
        return {'roles': trust['roles'],
                'links': trust['roles_links']}
----------------------------------------------------------------------

In the trust controller code, the following restrictions are currently hard-coded:

  create_trust - trustor only
  get_trust - trustor or trustee only
  l ist_trusts - admin only to list all trusts, trustor or trustee only for related trusts
  list_roles_for_trust - trustor or trustee only
  check_role_for_trust - trustor or trustee only
  get_role_for_trust - trustor or trustee only (indirectly via check_role_for_trust)
  delete_trust - admin or trustor only

The policies in policy.json can make these operations more restricted, but not less restricted than the hard-coded restrictions. We can't simply remove these settings from policy.json, as that would cause the "default" rule to be used which makes trusts unusable in the case of the default "default" rule of "admin_required". This only leaves us with the option of clearly documenting the behavior IMHO. Unfortunately, JSON doesn't allow comments, so we can't just add nice comments right there in policy.json. I think that the correct approach is:

- Add a general purpose paragraph to the RBAC section of doc/source/configuration.rst that states that some operations have hard-coded restrictions that policy is unable to circumvent. Mention that policy can still make these operations more restrictive.

- Add documentation for the trust extension at keystone/doc/source/extensions/trust.rst that mentions the hard-coded restrictions for each trust operation. Documentation for the trust extension in this area is completely missing at this time.

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

I like your suggestions, in particular the ones surrounding documentation for trusts.

Changed in keystone:
status: New → Confirmed
Nathan Kinder (nkinder)
Changed in keystone:
assignee: nobody → Nathan Kinder (nkinder)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/123862

Changed in keystone:
status: Confirmed → In Progress
Changed in keystone:
importance: Undecided → Medium
Dolph Mathews (dolph)
tags: added: documentation user-experience
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystone (master)

Change abandoned by Morgan Fainberg (<email address hidden>) on branch: master
Review: https://review.openstack.org/123862
Reason: This change is being abandoned because it has a negative score and has not seen an update in > 60 days. Feel free to re-instate this patch (as the author) by using the "restore" button or any member of the core team can re-instate the patch.

Revision history for this message
Dolph Mathews (dolph) wrote :

I've abandoned the referenced changed due to inactivity and failing tests. If this is still an issue, please reset the status.

Changed in keystone:
status: In Progress → Incomplete
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Dolph Mathews (<email address hidden>) on branch: master
Review: https://review.openstack.org/123862
Reason: Abandoning due to inactivity and failing tests.

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

Marking as invalid since this should have expired as incomplete long ago.

Changed in keystone:
assignee: Nathan Kinder (nkinder) → nobody
status: Incomplete → Invalid
Revision history for this message
Lance Bragstad (lbragstad) wrote :

This bug is technically fixed as of the Train release even though it's marked as invalid here.

The work related to this was tracked in separate bugs [0][1] and was part of a larger feature in keystone (spanning the entire API). The business logic in trusts specifically needed to be cleaned to remove the hard-coded checks that were originally implemented [2].

[0] https://bugs.launchpad.net/keystone/+bug/1818846
[1] https://bugs.launchpad.net/keystone/+bug/1818850
[2] https://review.opendev.org/#/q/topic:trust-policies+(status:open+OR+status:merged)

Colleen Murphy (krinkle)
Changed in keystone:
status: Invalid → 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.