Skip to content

Commit 039caab

Browse files
slawqoralonsoh
authored andcommitted
[S-RBAC] Fix new policies for FIP PFs APIs
During transition to the new secure RBAC API policies, we made mistake with policies for FIP PFs by defining them to be available for ADMIN_OR_PROJECT_MEMBER/READER or FIP owner. First, rule PROJECT_MEMBER/READER is not appropriate in this case as FIP PFs don't have tenant_id attribute at all and belongs to the owner of FIP always. Second issue was that any FIP owner, even with just READER role could possibly e.g. create port forwarding. To fix that, this patch changes those API policies to new rules: ADMIN_OR_PARENT_OWNER_READER ADMIN_OR_PARENT_OWNER_MEMBER Conflicts: neutron/conf/policies/floatingip_port_forwarding.py Closes-Bug: #2018989 Change-Id: Ibff4c4f5b6d020fd598831a8a6e8ec0e2f559005 (cherry picked from commit 4edff4f) (cherry picked from commit 812526a)
1 parent ca942e9 commit 039caab

File tree

2 files changed

+209
-154
lines changed

2 files changed

+209
-154
lines changed

neutron/conf/policies/floatingip_port_forwarding.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
rules = [
3030
policy.DocumentedRuleDefault(
3131
name='create_floatingip_port_forwarding',
32-
check_str=base.policy_or(
33-
base.ADMIN_OR_PROJECT_MEMBER,
34-
base.RULE_PARENT_OWNER),
32+
check_str=base.ADMIN_OR_PARENT_OWNER_MEMBER,
3533
scope_types=['project'],
3634
description='Create a floating IP port forwarding',
3735
operations=[
@@ -48,9 +46,7 @@
4846
),
4947
policy.DocumentedRuleDefault(
5048
name='get_floatingip_port_forwarding',
51-
check_str=base.policy_or(
52-
base.ADMIN_OR_PROJECT_READER,
53-
base.RULE_PARENT_OWNER),
49+
check_str=base.ADMIN_OR_PARENT_OWNER_READER,
5450
scope_types=['project'],
5551
description='Get a floating IP port forwarding',
5652
operations=[
@@ -71,9 +67,7 @@
7167
),
7268
policy.DocumentedRuleDefault(
7369
name='update_floatingip_port_forwarding',
74-
check_str=base.policy_or(
75-
base.ADMIN_OR_PROJECT_MEMBER,
76-
base.RULE_PARENT_OWNER),
70+
check_str=base.ADMIN_OR_PARENT_OWNER_MEMBER,
7771
scope_types=['project'],
7872
description='Update a floating IP port forwarding',
7973
operations=[
@@ -90,9 +84,7 @@
9084
),
9185
policy.DocumentedRuleDefault(
9286
name='delete_floatingip_port_forwarding',
93-
check_str=base.policy_or(
94-
base.ADMIN_OR_PROJECT_MEMBER,
95-
base.RULE_PARENT_OWNER),
87+
check_str=base.ADMIN_OR_PARENT_OWNER_MEMBER,
9688
scope_types=['project'],
9789
description='Delete a floating IP port forwarding',
9890
operations=[

0 commit comments

Comments
 (0)