]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: donot check for NotPrincipal in IsPublicStatement 58686/head
authorSeena Fallah <seenafallah@gmail.com>
Fri, 19 Jul 2024 17:34:25 +0000 (19:34 +0200)
committerSeena Fallah <seenafallah@gmail.com>
Fri, 19 Jul 2024 17:34:25 +0000 (19:34 +0200)
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 <seenafallah@gmail.com>
src/rgw/rgw_iam_policy.cc

index 94d7d1bf29c5ac9225268e0ad5b42543a40f8aa4..1901c6f87cbde383f9542645f3d30feb66e2c74f 100644 (file)
@@ -1893,14 +1893,10 @@ struct IsPublicStatement
   bool operator() (const Statement &s) const {
     if (s.effect == Effect::Allow) {
       for (const auto& p : s.princ) {
-       if (p.is_wildcard()) {
-         return s.eval_conditions(iam_all_env) == Effect::Allow;
-       }
+        if (p.is_wildcard()) {
+          return s.eval_conditions(iam_all_env) == Effect::Allow;
+        }
       }
-      // no princ should not contain fixed values
-      return std::none_of(s.noprinc.begin(), s.noprinc.end(), [](const rgw::auth::Principal& p) {
-                                                               return p.is_wildcard();
-                                                             });
     }
     return false;
   }