What changed, and why it matters
This commit is a small internal cleanup: it adds a new 'reset' method to the user-interface layer and makes the start of a new secure session call that method instead of calling a lower-level screen-clearing function directly. The behavior is essentially the same as before—clearing leftover screens when a new connection begins—so there is no new security problem. It is a refactoring change, not a fix for a known vulnerability.
No security action required; treat as normal code maintenance.
Security signals we found
Refactoring of UI screen-stack reset logic
No new functionality or behavior change in security boundary
No mention of vulnerability, CVE, bug bounty, or security advisory
Evidence from the diff
The change introduces a Ui::reset() trait method with an implementation that calls crate::ui::screen_stack_pop_all(), and replaces a direct call to bitbox02::ui::screen_stack_pop_all() in the noise handshake handler with hal.ui().reset(). A test stub is also added. The commit message and comments describe this as preventing stale screens from remaining visible across interrupted sessions. No vulnerability, bug class, or exploit path is described or evident in the diff.
Changed components
bitbox-hal UI traitbitbox02-rust noise handshake handlerbitbox02 HAL UI implementationtesting UI stubInspect captured patch +18 / −1
diff --git a/src/rust/bitbox-hal/src/ui.rs b/src/rust/bitbox-hal/src/ui.rs
index ecb55b9..52da12e 100644
--- a/src/rust/bitbox-hal/src/ui.rs
+++ b/src/rust/bitbox-hal/src/ui.rs
@@ -92,6 +92,15 @@ pub trait Ui {
/// [`crate::system::System::startup`]) to the BitBox logo.
fn switch_to_logo(&mut self);
+ /// Reset the UI screen stack to an empty state.
+ ///
+ /// This is be called when starting a fresh high-level session (when starting a new noise
+ /// handshake) so stale screens from an interrupted previous session do not remain visible.
+ ///
+ /// Implementations should clear all currently stacked UI components and leave the UI in its
+ /// default waiting state.
+ fn reset(&mut self);
+
fn progress_create(&mut self, title: &str) -> Self::Progress;
fn empty_create(&mut self) -> Self::Empty;
diff --git a/src/rust/bitbox02-rust/src/hal/testing/ui.rs b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
index db58a03..29a6f62 100644
--- a/src/rust/bitbox02-rust/src/hal/testing/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
@@ -149,6 +149,8 @@ impl Ui for TestingUi<'_> {
fn switch_to_logo(&mut self) {}
+ fn reset(&mut self) {}
+
async fn enter_string(
&mut self,
params: &EnterStringParams<'_>,
diff --git a/src/rust/bitbox02-rust/src/hww/noise.rs b/src/rust/bitbox02-rust/src/hww/noise.rs
index d07172f..0f7eeda 100644
--- a/src/rust/bitbox02-rust/src/hww/noise.rs
+++ b/src/rust/bitbox02-rust/src/hww/noise.rs
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
+use crate::hal::Ui;
use crate::workflow::pairing;
use alloc::vec::Vec;
use bitbox02::memory;
@@ -72,7 +73,7 @@ pub(crate) async fn process(
Some((&OP_I_CAN_HAS_HANDSHAEK, b"")) => {
// Pairing is the start of a session, so we clean the screen stack in case
// we started a new session in the middle of something.
- bitbox02::ui::screen_stack_pop_all();
+ hal.ui().reset();
NOISE_STATE
.0
diff --git a/src/rust/bitbox02/src/hal/ui.rs b/src/rust/bitbox02/src/hal/ui.rs
index 93159cb..ae01c50 100644
--- a/src/rust/bitbox02/src/hal/ui.rs
+++ b/src/rust/bitbox02/src/hal/ui.rs
@@ -134,6 +134,11 @@ impl Ui for BitBox02Ui {
crate::ui::screen_process_waiting_switch_to_logo();
}
+ #[inline(always)]
+ fn reset(&mut self) {
+ crate::ui::screen_stack_pop_all();
+ }
+
#[inline(always)]
async fn enter_string(
&mut self,
Why this scored 18/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.