acelyc111 commented on code in PR #1598:
URL:
https://github.com/apache/incubator-pegasus/pull/1598#discussion_r1357723201
##########
src/base/pegasus_utils.cpp:
##########
@@ -192,5 +195,41 @@ int c_unescape_string(const std::string &src, std::string
&dest)
return len;
}
+template <>
+std::string redact_sensitive_string(const std::string &src)
+{
+ if (FLAGS_encrypt_data_at_rest) {
+ return "<redacted>";
+ } else {
+ return src;
+ }
+}
+
+template <>
+dsn::blob redact_sensitive_string(const dsn::blob &src)
+{
+ static dsn::blob rbb =
dsn::blob::create_from_bytes(std::move("<redacted>"));
+ if (FLAGS_encrypt_data_at_rest) {
+ return rbb;
+ }
+
+ else {
+ return src;
+ }
+}
+
+template <>
+rocksdb::Slice redact_sensitive_string(const rocksdb::Slice &src)
+{
+ static rocksdb::Slice slice = rocksdb::Slice(std::move("<redacted>"));
+ if (FLAGS_encrypt_data_at_rest) {
+ return slice;
+ }
+
+ else {
Review Comment:
```suggestion
} else {
```
##########
src/base/pegasus_utils.h:
##########
@@ -106,6 +118,9 @@ std::string c_escape_string(const T &src, bool
always_escape = false)
// ----------------------------------------------------------------------
int c_unescape_string(const std::string &src, std::string &dest);
+template <typename T>
+T redact_sensitive_string(const T &src);
Review Comment:
Is it possible to return a const reference type?
##########
src/base/pegasus_utils.cpp:
##########
@@ -192,5 +195,41 @@ int c_unescape_string(const std::string &src, std::string
&dest)
return len;
}
+template <>
+std::string redact_sensitive_string(const std::string &src)
+{
+ if (FLAGS_encrypt_data_at_rest) {
+ return "<redacted>";
+ } else {
+ return src;
+ }
+}
+
+template <>
+dsn::blob redact_sensitive_string(const dsn::blob &src)
+{
+ static dsn::blob rbb =
dsn::blob::create_from_bytes(std::move("<redacted>"));
+ if (FLAGS_encrypt_data_at_rest) {
+ return rbb;
+ }
+
+ else {
Review Comment:
```suggestion
} else {
```
--
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]