What changed, and why it matters
This commit removes leftover debugging code from the Keystone 3 firmware. The most notable change is that in production builds, the device's debug UART output is now replaced with harmless '-' characters instead of potentially leaking real data. Other changes remove hard-coded test values and re-enable a normal boot-version check that had been bypassed. These are cleanup fixes that reduce the chance of sensitive information leaking through debug interfaces or test code being active in production.
Treat as a hardening/cleanup commit. Verify that production builds no longer emit real data over UART0, that the boot-version check is active in release firmware, and that no other debug/test overrides remain in production code paths. Review CI/build flags to ensure BUILD_PRODUCTION and COMPILE_SIMULATOR are set correctly for release images.
Security signals we found
Production UART output changed from raw buffer contents to placeholder '-' character, reducing risk of sensitive data leakage over debug interface
Hard-coded fake display/battery percentage value removed from status bar logic
Boot version mismatch check re-enabled after being disabled by commented-out code
Hard-coded test UR string and parse call removed from simulator entry point
Debug printf statements removed from simulator QR-code parsing path
Evidence from the diff
The patch removes debug/test artifacts across five files. In src/main.c, production builds now send ‘-’ over UART0 instead of the actual buffer contents, restoring intended production behavior. In gui_status_bar.c, a hard-coded ‘return 100;’ that forced a fake battery/display percentage is removed. In gui_init_view.c, the boot-version mismatch warning and early return are re-enabled after being commented out. In the UI simulator, a hard-coded UR (crypto-psbt-extend) test string and its parse call are removed, and several debug printf statements are deleted from simulator_model.c. The commit message simply says ‘delete debug code’ and does not frame any change as a security fix.
Changed components
src/main.csrc/ui/gui_components/gui_status_bar.csrc/ui/gui_views/gui_init_view.cui_simulator/main.cui_simulator/simulator_model.cInspect captured patch +3 / −12
diff --git a/src/main.c b/src/main.c
index 0c2f073..08edc8f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -115,8 +115,7 @@ int _write(int fd, char *pBuffer, int size)
for (int i = 0; i < size; i++) {
while (!UART_IsTXEmpty(UART0));
#ifdef BUILD_PRODUCTION
- // UART_SendData(UART0, '-');
- UART_SendData(UART0, (uint8_t) pBuffer[i]);
+ UART_SendData(UART0, '-');
#else
UART_SendData(UART0, (uint8_t) pBuffer[i]);
#endif
diff --git a/src/ui/gui_components/gui_status_bar.c b/src/ui/gui_components/gui_status_bar.c
index bc0aac9..51719da 100644
--- a/src/ui/gui_components/gui_status_bar.c
+++ b/src/ui/gui_components/gui_status_bar.c
@@ -394,7 +394,6 @@ const char *GetWalletNameByIndex(WALLET_LIST_INDEX_ENUM index)
uint8_t GetCurrentDisplayPercent(void)
{
- return 100;
#ifdef COMPILE_SIMULATOR
return 100;
#endif
diff --git a/src/ui/gui_views/gui_init_view.c b/src/ui/gui_views/gui_init_view.c
index 43bcd8c..637d002 100644
--- a/src/ui/gui_views/gui_init_view.c
+++ b/src/ui/gui_views/gui_init_view.c
@@ -48,8 +48,8 @@ static int32_t GuiInitViewInit(void *param)
}
if (IsBootVersionMatch() == false) {
- // GuiBootVersionNotMatchWidget();
- // return SUCCESS_CODE;
+ GuiBootVersionNotMatchWidget();
+ return SUCCESS_CODE;
}
GuiModeGetAccount();
return SUCCESS_CODE;
diff --git a/ui_simulator/main.c b/ui_simulator/main.c
index 368dbc1..b26a68c 100644
--- a/ui_simulator/main.c
+++ b/ui_simulator/main.c
@@ -96,10 +96,6 @@ int main(int argc, char **argv)
DeviceSettingsInit();
GuiStyleInit();
LanguageInit();
- #include "librust_c.h"
-
- char *ur = "ur:crypto-psbt-extend/oeadhdcxlkahssqzwfvslofzoxwkrewngotktbmwjkwdcmnefsaaehrlolkskncnktlbaypkaoadkirkbbly";
- URParseResult *result = parse_ur(ur);
GuiFrameOpenView(&g_initView);
// lv_example_calendar_1();
diff --git a/ui_simulator/simulator_model.c b/ui_simulator/simulator_model.c
index 0f293b0..e52e343 100644
--- a/ui_simulator/simulator_model.c
+++ b/ui_simulator/simulator_model.c
@@ -642,14 +642,11 @@ int32_t read_qrcode()
printf("urResult->error_code: %d\r\n", urResult->error_code);
break;
}
- printf("%s. %d.\n", __func__, __LINE__);
if (urResult->error_code == 0)
{
- printf("%s. %d.\n", __func__, __LINE__);
if (urResult->is_multi_part == 0)
{
- printf("%s. %d.\n", __func__, __LINE__);
// single qr code
firstQrFlag = true;
viewType.viewType = urResult->t;
Why this scored 47/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.