summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_op.cc
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@users.noreply.github.com>2023-12-08 20:43:54 +0100
committerGitHub <noreply@github.com>2023-12-08 20:43:54 +0100
commite6224ce777cfb4bf64d40fc8a2a81b61a9a33d80 (patch)
tree2381c7dff51c1a59b864e1cdb849826ac9bb5d9c /src/rgw/rgw_op.cc
parentMerge pull request #54749 from cbodley/wip-rgw-zone-old-pools (diff)
parentrgw/iam: admin/system users ignore iam policy parsing errors (diff)
downloadceph-e6224ce777cfb4bf64d40fc8a2a81b61a9a33d80.tar.xz
ceph-e6224ce777cfb4bf64d40fc8a2a81b61a9a33d80.zip
Merge pull request #54738 from cbodley/wip-63485
rgw/iam: admin/system users ignore iam policy parsing errors Reviewed-by: Adam C. Emerson <aemerson@redhat.com>
Diffstat (limited to 'src/rgw/rgw_op.cc')
-rw-r--r--src/rgw/rgw_op.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 39767f53989..750ad7cb773 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -638,18 +638,29 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::Driver* d
}
} catch (const std::exception& e) {
ldpp_dout(dpp, -1) << "Error reading IAM User Policy: " << e.what() << dendl;
- ret = -EACCES;
+ if (!s->system_request) {
+ ret = -EACCES;
+ }
}
}
try {
s->iam_policy = get_iam_policy_from_attr(s->cct, s->bucket_attrs, s->bucket_tenant);
} catch (const std::exception& e) {
- // Really this is a can't happen condition. We parse the policy
- // when it's given to us, so perhaps we should abort or otherwise
- // raise bloody murder.
ldpp_dout(dpp, 0) << "Error reading IAM Policy: " << e.what() << dendl;
- ret = -EACCES;
+
+ // This really shouldn't happen. We parse the policy when it's given to us,
+ // so a parsing failure here means we broke backward compatibility. The only
+ // sensible thing to do in this case is to deny access, because the policy
+ // may have.
+ //
+ // However, the only way for an administrator to repair such a bucket is to
+ // send a PutBucketPolicy or DeleteBucketPolicy request as an admin/system
+ // user. We can allow such requests, because even if the policy denied
+ // access, admin/system users override that error from verify_permission().
+ if (!s->system_request) {
+ ret = -EACCES;
+ }
}
bool success = driver->get_zone()->get_redirect_endpoint(&s->redirect_zone_endpoint);