From 3840b2c41c2e0e271673707c64af609c9227c4d8 Mon Sep 17 00:00:00 2001 From: kchheda3 Date: Fri, 31 May 2024 16:22:31 -0400 Subject: [PATCH] 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 --- src/rgw/rgw_common.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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); } -- 2.47.3