Policy.json is not exhaustive, missing many policy actions

Bug #1676672 reported by Felipe Monteiro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Won't Fix
Undecided
Unassigned

Bug Description

Currently, Cinder's policy.json does not exhaustively list all the policy actions within Cinder.

For example, volume:attach is enforced in code [0] but is not contained in the policy.json [1].

The implementation for policy enforcement in [0] is:

    @functools.wraps(func)
    def wrapped(self, context, target_obj, *args, **kwargs):
        check_policy(context, func.__name__, target_obj)
        return func(self, context, target_obj, *args, **kwargs)
    return wrapped

This means that each endpoint with @wrap_check_policy decorator above it should
be included in the policy.json but this is not the case.

Currently, the following policy actions are missing:

    "volume:attach": "rule:admin_or_owner",
    "volume:detach": "rule:admin_or_owner",
    "volume:reserve_volume": "rule:admin_or_owner",
    "volume:unreserve_volume": "rule:admin_or_owner",
    "volume:begin_detaching": "rule:admin_or_owner",
    "volume:roll_detaching": "rule:admin_or_owner",
    "volume:initialize_connection": "rule:admin_or_owner",
    "volume:terminate_connection": "rule:admin_or_owner",
    "volume:accept_transfer": "rule:admin_or_owner",
    "volume:get_volume_image_metadata": "rule:admin_or_owner",
    "volume:copy_volume_to_image": "rule:admin_or_owner",
    "volume:extend": "rule:admin_or_owner",
    "volume:migrate_volume": "rule:admin_or_owner",
    "volume:migrate_volume_completion": "rule:admin_or_owner",
    "volume:attachment_create": "rule:admin_or_owner",
    "volume:attachment_update": "rule:admin_or_owner",
    "volume:attachment_delete": "rule:admin_or_owner",

[0] https://github.com/openstack/cinder/blob/master/cinder/volume/api.py
[1] https://github.com/openstack/cinder/blob/master/etc/cinder/policy.json

Felipe Monteiro (fm577c)
Changed in cinder:
assignee: nobody → Felipe Monteiro (fm577c)
description: updated
Felipe Monteiro (fm577c)
Changed in cinder:
status: New → Invalid
Felipe Monteiro (fm577c)
Changed in cinder:
status: Invalid → New
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Felipe Monteiro (<email address hidden>) on branch: master
Review: https://review.openstack.org/451095

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote : Bug Assignee Expired

Unassigning due to no activity for > 6 months.

Changed in cinder:
assignee: Felipe Monteiro (fm577c) → nobody
status: In Progress → Triaged
Revision history for this message
Matt Riedemann (mriedem) wrote :
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

We no longer use policy.json, plus, all policies are now defined in code as DocumentedRuleDefaults, so all policies will be mentioned in any generated policy files.

Changed in cinder:
status: Triaged → Won't Fix
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.