This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 5756ed4dd2c [fix][security] BE log exists print sensitive msg (#30174)
5756ed4dd2c is described below
commit 5756ed4dd2cb691f00999595883fad5fdbcab544
Author: Guangming Lu <[email protected]>
AuthorDate: Sun Feb 4 18:17:25 2024 +0800
[fix][security] BE log exists print sensitive msg (#30174)
* [fix][security] BE log exists print sensitive msg
* [fix][optimize] Optimize the coding import Lists dependency package
* Revert "[fix][optimize] Optimize the coding import Lists dependency
package"
This reverts commit 076cd9f7261ed19329852ea7989496b7fece8bad.
---
be/src/olap/task/engine_clone_task.cpp | 15 +++++++++++----
be/src/olap/task/engine_clone_task.h | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/be/src/olap/task/engine_clone_task.cpp
b/be/src/olap/task/engine_clone_task.cpp
index 8a9d6de7690..80d9df58640 100644
--- a/be/src/olap/task/engine_clone_task.cpp
+++ b/be/src/olap/task/engine_clone_task.cpp
@@ -31,6 +31,7 @@
#include <memory>
#include <mutex>
#include <ostream>
+#include <regex>
#include <set>
#include <shared_mutex>
#include <system_error>
@@ -395,7 +396,7 @@ Status
EngineCloneTask::_make_and_download_snapshots(DataDir& data_dir,
_clone_req.partition_id, _clone_req.schema_hash);
} else {
LOG_WARNING("failed to download snapshot from remote BE")
- .tag("url", remote_url_prefix)
+ .tag("url", _mask_token(remote_url_prefix))
.error(status);
}
@@ -539,11 +540,11 @@ Status EngineCloneTask::_download_files(DataDir*
data_dir, const std::string& re
std::string local_file_path = local_path + "/" + file_name;
- LOG(INFO) << "clone begin to download file from: " << remote_file_url
+ LOG(INFO) << "clone begin to download file from: " <<
_mask_token(remote_file_url)
<< " to: " << local_file_path << ". size(B): " << file_size
<< ", timeout(s): " << estimate_timeout;
- auto download_cb = [&remote_file_url, estimate_timeout,
&local_file_path,
+ auto download_cb = [this, &remote_file_url, estimate_timeout,
&local_file_path,
file_size](HttpClient* client) {
RETURN_IF_ERROR(client->init(remote_file_url));
client->set_timeout_ms(estimate_timeout * 1000);
@@ -559,7 +560,8 @@ Status EngineCloneTask::_download_files(DataDir* data_dir,
const std::string& re
}
if (local_file_size != file_size) {
LOG(WARNING) << "download file length error"
- << ", remote_path=" << remote_file_url << ",
file_size=" << file_size
+ << ", remote_path=" <<
_mask_token(remote_file_url)
+ << ", file_size=" << file_size
<< ", local_file_size=" << local_file_size;
return Status::InternalError("downloaded file size is not
equal");
}
@@ -839,4 +841,9 @@ Status EngineCloneTask::_finish_full_clone(Tablet* tablet,
// TODO(plat1ko): write cooldown meta to remote if this replica is
cooldown replica
}
+std::string EngineCloneTask::_mask_token(const std::string& str) {
+ std::regex pattern("token=[\\w|-]+");
+ return regex_replace(str, pattern, "token=******");
+}
+
} // namespace doris
diff --git a/be/src/olap/task/engine_clone_task.h
b/be/src/olap/task/engine_clone_task.h
index b8263b06589..ae8de520963 100644
--- a/be/src/olap/task/engine_clone_task.h
+++ b/be/src/olap/task/engine_clone_task.h
@@ -86,6 +86,8 @@ private:
Status _release_snapshot(const std::string& ip, int port, const
std::string& snapshot_path);
+ std::string _mask_token(const std::string& str);
+
private:
const TCloneReq& _clone_req;
vector<TTabletInfo>* _tablet_infos;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]