]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/sts: code for returning an error when an IAM policy
authorPritha Srivastava <prsrivas@redhat.com>
Fri, 18 Jun 2021 10:06:10 +0000 (15:36 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Thu, 23 Sep 2021 05:01:47 +0000 (10:31 +0530)
resource belongs to someone else's tenant.

While parsing the policy it discards the resource element,
but then when an operation is evaluated, since the resource element
is empty, it doesnt evaluate the resource at all and the policy
ends up erroneously allowing actions on resources in other tenants.

Fixes: https://tracker.ceph.com/issues/51219
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
src/rgw/rgw_iam_policy.cc

index c6a63110e62a88e8e69852944a79ce20dc78389c..4a5595b22b3a4505e7fa1c055db99512483d46e5 100644 (file)
@@ -562,10 +562,11 @@ bool ParseState::do_string(CephContext* cct, const char* s, size_t l) {
        a->account = pp->tenant;
       (w->id == TokenID::Resource ? t->resource : t->notresource)
        .emplace(std::move(*a));
-    }
-    else
+    } else {
       ldout(cct, 0) << "Supplied resource is discarded: " << string(s, l)
                    << dendl;
+      return false;
+    }
   } else if (w->kind == TokenKind::cond_key) {
     auto& t = pp->policy.statements.back();
     if (l > 0 && *s == '$') {