MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / wipeSensitiveDataAndCutToLength

Function wipeSensitiveDataAndCutToLength

src/Common/SensitiveDataMasker.cpp:254–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252
253
254std::string wipeSensitiveDataAndCutToLength(std::string str, size_t max_length, bool wipe_sensitive)
255{
256 std::string res = std::move(str);
257
258 if (wipe_sensitive)
259 if (auto masker = SensitiveDataMasker::getInstance())
260 masker->wipeSensitiveData(res);
261
262 size_t length = res.length();
263 if (max_length && (length > max_length))
264 {
265 constexpr size_t max_extra_msg_len = sizeof("... (truncated 18446744073709551615 characters)");
266 if (max_length < max_extra_msg_len)
267 return "(removed " + std::to_string(length) + " characters)";
268 max_length -= max_extra_msg_len;
269 res.resize(max_length);
270 res.append("... (truncated " + std::to_string(length - max_length) + " characters)");
271 }
272
273 return res;
274}
275
276}

Callers 3

executeQueryImplFunction · 0.85
serializeQueryFunction · 0.85

Calls 5

wipeSensitiveDataMethod · 0.80
to_stringFunction · 0.50
lengthMethod · 0.45
resizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected