Skip to content

Commit 019aaa4

Browse files
committed
rgw: donot check for NotPrincipal in IsPublicStatement
As NotPrincipal cannot be used with Effect Allow there is no need to check for that. Also before this change, policies without `NotPrincipal` were identified as a public as std::none_of() returns true on empty flats and the check was not considering the fact that the policy might have pricipals. but due to the missing concept from AWS about how to deal with Principal and NotPrincipal on Allow Effect we can just remove it. Signed-off-by: Seena Fallah <[email protected]>
1 parent fbb7c3d commit 019aaa4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/rgw/rgw_iam_policy.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,14 +1893,10 @@ struct IsPublicStatement
18931893
bool operator() (const Statement &s) const {
18941894
if (s.effect == Effect::Allow) {
18951895
for (const auto& p : s.princ) {
1896-
if (p.is_wildcard()) {
1897-
return s.eval_conditions(iam_all_env) == Effect::Allow;
1898-
}
1896+
if (p.is_wildcard()) {
1897+
return s.eval_conditions(iam_all_env) == Effect::Allow;
1898+
}
18991899
}
1900-
// no princ should not contain fixed values
1901-
return std::none_of(s.noprinc.begin(), s.noprinc.end(), [](const rgw::auth::Principal& p) {
1902-
return p.is_wildcard();
1903-
});
19041900
}
19051901
return false;
19061902
}

0 commit comments

Comments
 (0)