gavinchou commented on code in PR #70006:
URL: https://github.com/apache/doris/pull/70006#discussion_r4509428924
##########
cloud/src/meta-service/meta_service_helper.h:
##########
@@ -162,6 +162,61 @@ inline std::string hide_ak(std::string debug_string) {
return debug_string;
}
+// A cloud_unique_id `${version}:${instance_id}:${node_secret}` authenticates
a node, so only
+// the part up to the instance id may be logged, e.g. "1:instance_a:***".
+inline void append_hidden_cloud_unique_id(std::string* out, std::string_view
cloud_unique_id) {
+ if (cloud_unique_id.empty()) {
+ return;
+ }
+ size_t pos = cloud_unique_id.find(':');
+ pos = pos == std::string_view::npos ? pos : cloud_unique_id.find(':', pos
+ 1);
+ out->append(cloud_unique_id.substr(0, pos == std::string_view::npos ? 0 :
pos + 1));
+ out->append("***");
+}
+
+inline std::string hide_cloud_unique_id(std::string_view cloud_unique_id) {
+ std::string out;
+ append_hidden_cloud_unique_id(&out, cloud_unique_id);
+ return out;
+}
+
+// Applies hide_cloud_unique_id() to every cloud_unique_id(s) value in a
protobuf debug string
+// (`cloud_unique_id: "xxx"`), a JSON string (`"cloud_unique_id":"xxx"`) or a
log message
+// (`cloud_unique_id=xxx`).
+inline std::string hide_cloud_unique_ids(std::string str) {
Review Comment:
way too complex
can we make it simpler?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]