← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1862561] Re: os-create-backup API policy is allowed for everyone even policy defaults is admin_or_owner

 

Reviewed:  https://review.opendev.org/706727
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=30bcb43ca5bfc1f6f0efe9298ce2f9dbf9431e2e
Submitter: Zuul
Branch:    master

commit 30bcb43ca5bfc1f6f0efe9298ce2f9dbf9431e2e
Author: Ghanshyam Mann <gmann@xxxxxxxxxxxxxxxxx>
Date:   Sun Feb 9 19:57:10 2020 -0600

    Fix os-create-backup policy to be admin_or_owner
    
    os-create-backup API policy is default to admin_or_owner[1] but API
    is allowed for everyone.
    
    We can see the test trying with other project context can access the API
    - https://review.opendev.org/#/c/706726/
    
    This is because API does not pass the server project_id in policy target[2]
    and if no target is passed then, policy.py add the default targets which is
    nothing but context.project_id (allow for everyone who try to access)[3]
    
    This commit fix this policy by passing the server's project_id in policy
    target.
    
    [1] https://github.com/openstack/nova/blob/1fcd74730d343b7cee12a0a50ea537dc4ff87f65/nova/policies/create_backup.py#L27
    [2] https://github.com/openstack/nova/blob/1fcd74730d343b7cee12a0a50ea537dc4ff87f65/nova/api/openstack/compute/create_backup.py#L50
    [3] https://github.com/openstack/nova/blob/c16315165ce307c605cf4b608b2df3aa06f46982/nova/policy.py#L191
    
    Change-Id: I36cba4c6760f8f9faa5f3039cbb11ea1dc296f68
    Closes-bug: #1862561


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1862561

Title:
  os-create-backup API policy is allowed for everyone even policy
  defaults is admin_or_owner

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  os-create-backup API policy is default to admin_or_owner[1] but API is
  allowed for everyone.

  We can see the test trying with other project context can access the API
  - https://review.opendev.org/#/c/706726/

  This is because API does not pass the server project_id in policy target
  - https://github.com/openstack/nova/blob/1fcd74730d343b7cee12a0a50ea537dc4ff87f65/nova/api/openstack/compute/create_backup.py#L50

  and if no target is passed then, policy.py add the default targets which is nothing but context.project_id (allow for everyone try to access)
  - https://github.com/openstack/nova/blob/c16315165ce307c605cf4b608b2df3aa06f46982/nova/policy.py#L191

  [1]
  - https://github.com/openstack/nova/blob/1fcd74730d343b7cee12a0a50ea537dc4ff87f65/nova/policies/create_backup.py#L27

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1862561/+subscriptions


References