From: Sun Yuechi Date: Tue, 30 Jun 2026 06:44:56 +0000 (+0800) Subject: rgw/sts: fix inverted tokenCode length validation X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=439534ab9b60f4ebe5d9896697cff2ba73653378;p=ceph.git rgw/sts: fix inverted tokenCode length validation validate_input() rejected the valid TOKEN_CODE_SIZE length and accepted all others. Compare with != so only a wrong length is rejected. Fixes: https://tracker.ceph.com/issues/77872 Signed-off-by: Sun Yuechi --- diff --git a/src/rgw/rgw_sts.cc b/src/rgw/rgw_sts.cc index 357a153e222d..ebf0d5140ba2 100644 --- a/src/rgw/rgw_sts.cc +++ b/src/rgw/rgw_sts.cc @@ -282,7 +282,7 @@ int AssumeRoleRequest::validate_input(const DoutPrefixProvider *dpp) const return -EINVAL; } } - if (! tokenCode.empty() && tokenCode.size() == TOKEN_CODE_SIZE) { + if (! tokenCode.empty() && tokenCode.size() != TOKEN_CODE_SIZE) { ldpp_dout(dpp, 0) << "Either token code is empty or token code size is invalid: " << tokenCode.size() << dendl; return -EINVAL; }