libjade: compile out debug logging under CONFIG_LOG_DEFAULT_LEVEL_NONE
What changed, and why it matters
This commit changes how debug logging is handled in a library version of Blockstream Jade (libjade). When a build option that disables logging is set, the code now completely removes the internal log-level variable and the function that adjusts it, rather than just setting them to 'no logging.' This is a hardening/cleanup change that reduces the chance that sensitive debug information could accidentally leak in builds meant to be silent, but it does not by itself fix any active vulnerability.
Treat as a routine hardening improvement. No urgent action required. If deploying libjade builds with `CONFIG_LOG_DEFAULT_LEVEL_NONE`, verify that expected log output is absent and that the build still compiles cleanly across supported toolchains.
Security signals we found
Compile-time removal of logging control surface when logging is disabled
Reduction of state that could be manipulated to enable verbose logging
No direct evidence of an exploitable vulnerability being patched
Evidence from the diff
The patch wraps _libjade_log_level and libjade_set_log_level() with #ifndef CONFIG_LOG_DEFAULT_LEVEL_NONE. When CONFIG_LOG_DEFAULT_LEVEL_NONE is defined at compile time, the global log-level variable and the API to change it are compiled out entirely. The header also defines _libjade_log_level as a constant ESP_LOG_NONE in that case so the existing ESP_LOGD/ESP_LOGI/etc. macros still compile but remain no-ops. This is a defensive compile-time hardening measure, not a runtime bug fix.
Changed components
libjade/include/esp_log.hlibjade/libjade.cInspect captured patch +8 / −0
diff --git a/libjade/include/esp_log.h b/libjade/include/esp_log.h
index 058748a..13595ae 100644
--- a/libjade/include/esp_log.h
+++ b/libjade/include/esp_log.h
@@ -12,7 +12,11 @@ typedef enum {
ESP_LOG_NONE = 5
} esp_log_level_t;
+#ifdef CONFIG_LOG_DEFAULT_LEVEL_NONE
+#define _libjade_log_level ESP_LOG_NONE
+#else
extern esp_log_level_t _libjade_log_level;
+#endif
#define ESP_LOGD(f, fmt, ...) \
do { \
diff --git a/libjade/libjade.c b/libjade/libjade.c
index b6d42c4..db1d923 100644
--- a/libjade/libjade.c
+++ b/libjade/libjade.c
@@ -107,7 +107,9 @@ bool idletimer_register_activity(const bool is_ui) { return true; }
void idletimer_set_min_timeout_secs(uint16_t min_timeout_secs){};
// main/logging.c
+#ifndef CONFIG_LOG_DEFAULT_LEVEL_NONE
esp_log_level_t _libjade_log_level = ESP_LOG_NONE;
+#endif
// main/selfcheck.c
bool debug_selfcheck(jade_process_t* process) { return true; }
@@ -559,6 +561,7 @@ void libjade_release(uint8_t* data) { vRingbufferReturnItem(serial_out, (void*)d
void libjade_set_log_level(int level)
{
+#ifndef CONFIG_LOG_DEFAULT_LEVEL_NONE
// Note we don't bother about thread safety for _libjade_log_level
if (level < 0) {
_libjade_log_level = ESP_LOG_VERBOSE;
@@ -567,4 +570,5 @@ void libjade_set_log_level(int level)
} else {
_libjade_log_level = (esp_log_level_t)level;
}
+#endif
}
Why this scored 19/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.