Policy check target is inconsistent in use of domain_id

Bug #1616669 reported by Steve McLellan
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Confirmed
Medium
David Lyle

Bug Description

The code starting at https://github.com/openstack/django_openstack_auth/blob/master/openstack_auth/policy.py#L130 sets four keys on the policy check target equal to the user's domain id (e.g the domain in which the user was created). Line 144 then reassigns the 'domain_id' key with the domain to which the user has a scoped token *if* they have such a token.

This creates a double meaning for domain_id. When keystone uses 'domain_id' in policy checks, the meaning is 'the domain to which a token is scoped', so a check for 'is a domain admin' might be 'role:admin and domain_id:%(domain_id)s'. Under Horizon this doesn't work, since the domain_id part essentially always passes, and thus a project admin is indistinguishable from a domain admin.

My proposal is to set domain_id only if there is a domain scoped token. If a policy check actually requires the user's domain, it can use attributes on the token (token.user.domain.id).

Changed in horizon:
milestone: none → newton-rc1
David Lyle (david-lyle)
Changed in horizon:
status: New → Confirmed
importance: Undecided → Medium
Steve McLellan (sjmc7)
Changed in horizon:
assignee: nobody → Steve McLellan (sjmc7)
Revision history for this message
Steve McLellan (sjmc7) wrote :

One example problem case is where you are the admin of a project; the admin_and_matching_domain_id rule is defined as "rule:admin_required and domain_id:%(domain_id)s". Since in the existing code the domain_id:%(domain_id)s is equivalent to user_domain_id==user_domain_id it always passes and thus you are a domain admin.

openstack_dashboard/api/keystone uses this rule for 'is_domain_admin', which then tries to make API calls against keystone that will fail depending how keystone's policy file is set up (and logically should fail).

Changed in horizon:
milestone: newton-rc1 → next
Changed in horizon:
assignee: Steve McLellan (sjmc7) → nobody
David Lyle (david-lyle)
Changed in horizon:
assignee: nobody → David Lyle (david-lyle)
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.