From 4ecd467ca079e5cbc53ec24a03d529a3d980e0d0 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Tue, 23 Jan 2018 00:24:03 -0500 Subject: [PATCH] BeesBlockData: don't leak file contents in the log The data field of BeesBlockData is only interesting to those who want to debug the BeesBlockData implementation or other battle-tested parts of bees. Users who want to do this can modify and rebuild the source to enable the output. To everyone else, the data field is a huge, ongoing infoleak through the log. Don't bother with an option, just output the length of the data field and nothing else. Fixes: https://github.com/Zygo/bees/issues/53 Signed-off-by: Zygo Blaxell --- src/bees-types.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bees-types.cc b/src/bees-types.cc index 3b57e87..cfbec24 100644 --- a/src/bees-types.cc +++ b/src/bees-types.cc @@ -877,6 +877,9 @@ operator<<(ostream &os, const BeesBlockData &bbd) os << ", hash = " << bbd.m_hash; } if (!bbd.m_data.empty()) { +// Turn this on to debug BeesBlockData, but leave it off otherwise. +// It's a massive data leak that is only interesting to developers. +#if 0 os << ", data[" << bbd.m_data.size() << "] = '"; size_t max_print = 12; @@ -893,6 +896,9 @@ operator<<(ostream &os, const BeesBlockData &bbd) } } os << "...'"; +#else + os << ", data[" << bbd.m_data.size() << "]"; +#endif } return os << " }"; }