yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #82128
[Bug 1869791] Re: unlock server API policy is allowed for everyone even policy defaults is admin_or_owner
Reviewed: https://review.opendev.org/716071
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=472a9d45038d0152fd8c179e078572b187183528
Submitter: Zuul
Branch: master
commit 472a9d45038d0152fd8c179e078572b187183528
Author: Ghanshyam Mann <gmann@xxxxxxxxxxxxxxxxx>
Date: Mon Mar 30 10:04:52 2020 -0500
Fix unlock server policy to be admin_or_owner
unlock 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/716057/
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: #1869791
Partial implement blueprint policy-defaults-refresh
[1] https://github.com/openstack/nova/blob/7b51647f17c88c7c1ae321c59ab8a98c586d4b67/nova/policies/lock_server.py#L38
[2] https://github.com/openstack/nova/blob/a534ccc5a7dbe687277d9233883f500ec635fe04/nova/api/openstack/compute/lock_server.py#L46
[3] https://github.com/openstack/nova/blob/c16315165ce307c605cf4b608b2df3aa06f46982/nova/policy.py#L191
Change-Id: I84dd0edd89d9c9d58f3136d90becc07d44c9b39a
** 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/1869791
Title:
unlock server API policy is allowed for everyone even policy defaults
is admin_or_owner
Status in OpenStack Compute (nova):
Fix Released
Bug description:
unlock 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/716057/
This is because API does not pass the server project_id in policy target
- https://github.com/openstack/nova/blob/a534ccc5a7dbe687277d9233883f500ec635fe04/nova/api/openstack/compute/lock_server.py#L46
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/7b51647f17c88c7c1ae321c59ab8a98c586d4b67/nova/policies/lock_server.py#L38
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1869791/+subscriptions
References