← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1870883] Re: resume server API policy is allowed for everyone even policy defaults is admin_or_owner Edit

 

Reviewed:  https://review.opendev.org/717561
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=11dc8014941dc814f51542e4569b43607ba28c1b
Submitter: Zuul
Branch:    master

commit 11dc8014941dc814f51542e4569b43607ba28c1b
Author: Ghanshyam Mann <gmann@xxxxxxxxxxxxxxxxx>
Date:   Sun Apr 5 03:05:01 2020 -0500

    Fix resume server policy to be admin_or_owner
    
    resume server 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/717182/
    
    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.
    
    Closes-bug: #1870883
    Partial implement blueprint policy-defaults-refresh
    
    [1] https://github.com/openstack/nova/blob/e4ac401d1a9d5fba24bc22141b362a5400d9d096/nova/policies/suspend_server.py#L37
    [2] https://github.com/openstack/nova/blob/e4ac401d1a9d5fba24bc22141b362a5400d9d096/nova/api/openstack/compute/suspend_server.py#L56
    
    Change-Id: I9a8ef87d21b0c4e5d15ef3a2f99297705d5c7f15


** 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/1870883

Title:
  resume server API policy is allowed for everyone even policy defaults
  is admin_or_owner Edit

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  server resume 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/717182/

  This is because API does not pass the server project_id in policy target
  - https://github.com/openstack/nova/blob/e4ac401d1a9d5fba24bc22141b362a5400d9d096/nova/api/openstack/compute/suspend_server.py#L56

  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/e4ac401d1a9d5fba24bc22141b362a5400d9d096/nova/policies/suspend_server.py#L37

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


References