Don't raise InvalidScope exception when do_raise parameter is set to False

Bug #1965315 reported by Slawek Kaplonski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.policy
Fix Released
Undecided
Unassigned

Bug Description

Enforcer.enforce() method has got parameter do_raise which is False by default and in such case that method don't raise PolicyNotAuthorized exception and returns False in case when policy wasn't authorized.
Unfortunately it's not working the same way for scope enforcing and InvalidScope exception is raised always, no matter what is value of the do_raise parameter. It should raise this exception only in case when do_raise is set to True.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.policy (master)
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/c/openstack/oslo.policy/+/834222
Committed: https://opendev.org/openstack/oslo.policy/commit/9bc1783400f9960b7132bf631c690a98fbfc8066
Submitter: "Zuul (22348)"
Branch: master

commit 9bc1783400f9960b7132bf631c690a98fbfc8066
Author: Slawek Kaplonski <email address hidden>
Date: Thu Mar 17 20:35:45 2022 +0100

    Don't raise InvalidScope exception when do_raise=False

    In the Enforcer.enforce() method there is boolean parameter do_raise.
    When it is set to False, enforce() method should return True/False as an
    enforcement result and not raise exception. It works like that with
    PolicyNotAuthorized exception but since some time this method can also
    raise InvalidScope exception and in such case behaviour was different.

    This patch changes that behaviour so InvalidScope exception will also
    not be raised when do_raise=False.

    Closes-bug: #1965315
    Change-Id: I37fd682ffa9d6f4c69698e1be42adac28bbfe72a

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 3.12.0

This issue was fixed in the openstack/oslo.policy 3.12.0 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.