kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [6/6] kudu git commit: KUDU-1812: redact HexDump output
Date Fri, 23 Dec 2016 00:47:35 GMT
KUDU-1812: redact HexDump output

After auditing calls to HexDump across the (non-test) Kudu codebase, it
was found that all calls would require manual redaction. Instead of
requiring callers to manually redact, it's easier to do it centrally.

Change-Id: I8388b19801382c491c9bcd9a485b1978ec0f007e
Reviewed-on: http://gerrit.cloudera.org:8080/5567
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Reviewed-by: Adar Dembo <adar@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/47f09e30
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/47f09e30
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/47f09e30

Branch: refs/heads/master
Commit: 47f09e30fde1726531544ba530651af39d9aa29e
Parents: c097515
Author: Dan Burkert <danburkert@apache.org>
Authored: Wed Dec 21 23:26:42 2016 -0800
Committer: Dan Burkert <danburkert@apache.org>
Committed: Fri Dec 23 00:39:32 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/hexdump.cc | 8 +++++++-
 src/kudu/util/hexdump.h  | 9 +++++----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/47f09e30/src/kudu/util/hexdump.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/hexdump.cc b/src/kudu/util/hexdump.cc
index 250c7c0..8f7c6cd 100644
--- a/src/kudu/util/hexdump.cc
+++ b/src/kudu/util/hexdump.cc
@@ -15,16 +15,22 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/util/hexdump.h"
+
 #include <algorithm>
 #include <string>
 
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/util/hexdump.h"
+#include "kudu/util/logging.h"
 #include "kudu/util/slice.h"
 
 namespace kudu {
 
 std::string HexDump(const Slice &slice) {
+  if (KUDU_SHOULD_REDACT()) {
+    return kRedactionMessage;
+  }
+
   std::string output;
   output.reserve(slice.size() * 5);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/47f09e30/src/kudu/util/hexdump.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/hexdump.h b/src/kudu/util/hexdump.h
index 55deed4..eacfad2 100644
--- a/src/kudu/util/hexdump.h
+++ b/src/kudu/util/hexdump.h
@@ -23,10 +23,11 @@ namespace kudu {
 
 class Slice;
 
-// Generate an 'xxd'-style hexdump of the given slice.
-// This should only be used for debugging, as the format is
-// subject to change and it has not been implemented for
-// speed.
+// Generate an 'xxd'-style hexdump of the given slice.  This should only be used
+// for debugging, as the format is subject to change and it has not been
+// implemented for speed.
+//
+// The returned string will be redacted if redaction is enabled.
 std::string HexDump(const Slice &slice);
 
 } // namespace kudu


Mime
View raw message