From: Pritha Srivastava Date: Thu, 9 Oct 2025 06:05:13 +0000 (+0530) Subject: rgw/sts: correct error code to 400 (from 403) X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F65847%2Fhead;p=ceph.git rgw/sts: correct error code to 400 (from 403) for expires sts credentials. Fixes: https://tracker.ceph.com/issues/73441 Signed-off-by: Pritha Srivastava --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 7d102224d872..faf80be64bc1 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -145,6 +145,7 @@ rgw_http_errors rgw_http_s3_errors({ { ERR_ACLS_NOT_SUPPORTED, {400, "AccessControlListNotSupported"}}, { ERR_INVALID_BUCKET_ACL, {400, "InvalidBucketAclWithObjectOwnership"}}, { ERR_NO_SUCH_OWNERSHIP_CONTROLS, {404, "OwnershipControlsNotFoundError"}}, + { ERR_EXPIRED_TOKEN, {400, "ExpiredToken"}}, }); rgw_http_errors rgw_http_swift_errors({ diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 40ab41c400ff..8f95f4ef6716 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -368,7 +368,8 @@ inline constexpr const char* RGW_REST_STS_XMLNS = #define ERR_ACCOUNT_EXISTS 2403 #define ERR_RESTORE_ALREADY_IN_PROGRESS 2500 - +#define ERR_EXPIRED_TOKEN 2501 + #ifndef UINT32_MAX #define UINT32_MAX (0xffffffffu) #endif diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 909246c221f8..a90346b6886a 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -7257,7 +7257,7 @@ rgw::auth::s3::STSEngine::authenticate( real_clock::time_point now = real_clock::now(); if (now >= *exp) { ldpp_dout(dpp, 0) << "ERROR: Token expired" << dendl; - return result_t::reject(-EPERM); + return result_t::reject(-ERR_EXPIRED_TOKEN); } } else { ldpp_dout(dpp, 0) << "ERROR: Invalid expiration: " << expiration << dendl;