Skip to content

Commit

Permalink
Redacted user key-values printed in logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
yujingwei committed Oct 17, 2023
1 parent 7bde304 commit 9e72d86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/base/pegasus_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace utils {
// it's seconds since 2016.01.01-00:00:00 GMT
const uint32_t epoch_begin = 1451606400;
inline uint32_t epoch_now() { return time(nullptr) - epoch_begin; }
const static std::string sSensitiveString = "<redactde>";
const static std::string kRedactedString = "<redactde>";

// extract "host" from rpc_address
void addr2host(const ::dsn::rpc_address &addr, char *str, int len);
Expand Down Expand Up @@ -105,7 +105,7 @@ template <class T>
std::string c_escape_sensitive_string(const T &src, bool always_escape = false)
{
if (FLAGS_encrypt_data_at_rest) {
return sSensitiveString;
return kRedactedString;
}
return c_escape_string(src, always_escape);
}
Expand All @@ -120,10 +120,10 @@ std::string c_escape_sensitive_string(const T &src, bool always_escape = false)
int c_unescape_string(const std::string &src, std::string &dest);

template <class T>
std::string redact_sensitive_string(const T &src)
const std::string &redact_sensitive_string(const T &src)
{
if (FLAGS_encrypt_data_at_rest) {
return sSensitiveString;
return kRedactedString;
} else {
return src;
}
Expand Down

0 comments on commit 9e72d86

Please sign in to comment.