Can't move to or from empty policy with deprecated_rule

Bug #1856207 reported by Zane Bitter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.policy
Fix Released
Undecided
Zane Bitter

Bug Description

When a policy is deprecated, we allow access to requests that would be allowed by either the old or the new rule.

Currently this is implemented by sticking the string ' or ' between the old and new rules and parsing the result as a whole. That means that if either the old or new rules is an empty string then you end up with an error like:

"Failed to understand rule or role:admin: ValueError: Could not parse rule"

(With quotes that would look like "rule ' or role:admin'".)

It's possible that this works correctly with unparenthesised inputs containing and/or/not, since IIUC the 'or' operator has the lowest precedence, but I wouldn't say it was obviously correct either.

Zane Bitter (zaneb)
Changed in oslo.policy:
assignee: nobody → Zane Bitter (zaneb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.policy (master)

Fix proposed to branch: master
Review: https://review.opendev.org/698790

Changed in oslo.policy:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.policy (master)

Reviewed: https://review.opendev.org/698790
Committed: https://git.openstack.org/cgit/openstack/oslo.policy/commit/?id=b93f51c1aa85ca4735118668d1f890ca0fbe941d
Submitter: Zuul
Branch: master

commit b93f51c1aa85ca4735118668d1f890ca0fbe941d
Author: Zane Bitter <email address hidden>
Date: Thu Dec 12 11:03:30 2019 -0500

    Don't use string processing to combine deprecated rules

    Constructing a policy string by sticking ' or ' between the new and
    deprecated check_str values is error-prone. Construct the policy
    programmatically instead by parsing the check_str values separately and
    combining them into an OrCheck.

    Change-Id: Ia2ee05aa08326c6daa214a7b1156baa6efe43dc0
    Closes-Bug: #1856207

Changed in oslo.policy:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.policy 2.4.1

This issue was fixed in the openstack/oslo.policy 2.4.1 release.

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.