From: kchheda3 Date: Fri, 31 May 2024 20:22:31 +0000 (-0400) Subject: rgw/notification: add logic to prevent logging password associated with topics. X-Git-Tag: v20.0.0~975^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3840b2c41c2e0e271673707c64af609c9227c4d8;p=ceph.git rgw/notification: add logic to prevent logging password associated with topics. Follow-up to commit https://github.com/ceph/ceph/pull/56493/commits/334009fb7364bea6c4d4ba91901d18641811ac5f as part of PR #56493, add logic to mask the password printed. Signed-off-by: kchheda3 --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 4c9203093487..76aadbd06e65 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -874,7 +874,17 @@ int RGWHTTPArgs::parse(const DoutPrefixProvider *dpp) }); } string& val = nv.get_val(); - ldpp_dout(dpp, 10) << "name: " << name << " val: " << val << dendl; + static constexpr std::initializer_list + sensitive_keyword_list = {"password"}; + bool is_sensitive = false; + for (const auto& key : sensitive_keyword_list) { + if (name.find(key) != std::string::npos) { + is_sensitive = true; + break; + } + } + ldpp_dout(dpp, 10) << "name: " << name + << " val: " << (is_sensitive ? "****" : val) << dendl; append(name, val); }