log: Print warning about privacy-sensitive log info unconditionally
What changed, and why it matters
This commit changes when Bitcoin Core prints a privacy warning about log files. Previously, the warning only appeared when extra 'debug' logging was turned on. Now it prints every time the node starts, because ordinary logs can also contain sensitive details. It is a privacy-awareness improvement, not a fix for an active security flaw.
No security action required. Treat as a routine UX/privacy-hardening change. Operators should continue to review logs before sharing them.
Security signals we found
Unconditional privacy warning added to startup logging
No functional change to logging behavior or data handling
No input validation, memory safety, or cryptographic changes
Evidence from the diff
The patch removes the conditional if (LogInstance().GetCategoryMask() != BCLog::NONE) guard around the startup log message warning that logs may contain privacy-sensitive information. The warning is now emitted unconditionally in SetLoggingCategories(). The rest of the diff is whitespace/indentation cleanup in the same function.
Changed components
src/init/common.cppSetLoggingCategories()Startup log outputInspect captured patch +10 / −12
diff --git a/src/init/common.cpp b/src/init/common.cpp
index c0695e52..cb35c1b4 100644
--- a/src/init/common.cpp
+++ b/src/init/common.cpp
@@ -78,19 +78,19 @@ util::Result<void> SetLoggingLevel(const ArgsManager& args)
util::Result<void> SetLoggingCategories(const ArgsManager& args)
{
- const std::vector<std::string> categories = args.GetArgs("-debug");
+ const std::vector<std::string> categories = args.GetArgs("-debug");
- // Special-case: Disregard any debugging categories appearing before -debug=0/none
- const auto last_negated = std::find_if(categories.rbegin(), categories.rend(),
- [](const std::string& cat) { return cat == "0" || cat == "none"; });
+ // Special-case: Disregard any debugging categories appearing before -debug=0/none
+ const auto last_negated = std::find_if(categories.rbegin(), categories.rend(),
+ [](const std::string& cat) { return cat == "0" || cat == "none"; });
- const auto categories_to_process = (last_negated == categories.rend()) ? categories : std::ranges::subrange(last_negated.base(), categories.end());
+ const auto categories_to_process = (last_negated == categories.rend()) ? categories : std::ranges::subrange(last_negated.base(), categories.end());
- for (const auto& cat : categories_to_process) {
- if (!LogInstance().EnableCategory(cat)) {
- return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)};
- }
+ for (const auto& cat : categories_to_process) {
+ if (!LogInstance().EnableCategory(cat)) {
+ return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)};
}
+ }
// Now remove the logging categories which were explicitly excluded
for (const std::string& cat : args.GetArgs("-debugexclude")) {
@@ -99,9 +99,7 @@ util::Result<void> SetLoggingCategories(const ArgsManager& args)
}
}
- if (LogInstance().GetCategoryMask() != BCLog::NONE) {
- LogInfo("Debug logging is enabled (-debug). Additional log output may contain privacy-sensitive information. Be cautious when sharing logs.");
- }
+ LogInfo("Log output may contain privacy-sensitive information. Be cautious when sharing logs.");
return {};
}
Why this scored 27/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.