feat(core/delizia): allow external menu with hold
What changed, and why it matters
This commit changes how a confirmation screen behaves on the Trezor Safe 5 (Delizia) when there is no text to display and the user must hold a button to confirm. It allows an external menu to appear alongside the hold-to-confirm prompt, and uses a custom label (verb) as the on-screen footer. The change is a UI feature, not a fix for a known exploit, and the commit message does not claim any security relevance.
Treat as a normal feature commit. A focused security review of the new MsgMap path and the prompt_frame footer behavior is prudent to confirm that hold-to-confirm cannot be bypassed by UI events, but no immediate incident response is indicated by the supplied materials.
Security signals we found
The change explicitly avoids Frame::map because a tap on the footer would otherwise emit FlowMsg::Next and confirm without the required hold gesture.
The new MsgMap mapping returns None for unhandled messages, which should prevent accidental confirmation.
The commit is tagged [no changelog] and framed purely as a feature, with no security advisory or CVE reference.
Evidence from the diff
The patch modifies the Delizia confirm_action flow so that when external_menu=true, hold=true, and both action/description are None, it renders only the hold prompt with the supplied verb as the footer and an external menu button. It introduces a new prompt_frame helper and uses MsgMap to ensure a tap on the footer does not bypass the required hold gesture. The previous guard that rejected external_menu combined with hold/prompt_screen is relaxed only for the no-text case.
Changed components
core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rscore/embed/rust/src/ui/layout_delizia/ui_firmware.rscore/embed/rust/src/ui/api/firmware_micropython.rscore/mocks/generated/trezorui_api.pyiInspect captured patch +59 / −21
### core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -1476,7 +1476,8 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// prompt_title: str | None = None,
/// external_menu: bool = False,
/// ) -> LayoutContext[UiResult]:
- /// """Confirm action."""
+ /// """Confirm action. Delizia: with an external menu and no text, only the hold prompt
+ /// is shown."""
Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(),
/// def confirm_address(
### core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs
@@ -1,7 +1,8 @@
use heapless::Vec;
use super::super::component::{
- Footer, Frame, Header, PromptScreen, SwipeContent, VerticalMenu, VerticalMenuChoiceMsg,
+ Footer, Frame, FrameMsg, Header, PromptMsg, PromptScreen, SwipeContent, VerticalMenu,
+ VerticalMenuChoiceMsg,
};
use super::super::theme;
use crate::maybe_trace::MaybeTrace;
@@ -12,7 +13,7 @@ use crate::ui::component::swipe_detect::SwipeSettings;
use crate::ui::component::text::paragraphs::{
Paragraph, ParagraphSource, ParagraphVecShort, VecExt,
};
-use crate::ui::component::{Component, ComponentExt, EventCtx, Paginate};
+use crate::ui::component::{Component, ComponentExt, EventCtx, MsgMap, Paginate};
use crate::ui::flow::base::{Decision, DecisionBuilder as _};
use crate::ui::flow::{FlowController, FlowMsg, SwipeFlow, SwipePage};
use crate::ui::geometry::Direction;
@@ -282,6 +283,7 @@ pub fn new_confirm_action(
action: Option<TString<'static>>,
description: Option<TString<'static>>,
subtitle: Option<TString<'static>>,
+ verb: Option<TString<'static>>,
verb_cancel: Option<TString<'static>>,
reverse: bool,
hold: bool,
@@ -290,6 +292,19 @@ pub fn new_confirm_action(
prompt_title: TString<'static>,
external_menu: bool,
) -> Result<SwipeFlow, Error> {
+ if external_menu && hold && action.is_none() && description.is_none() {
+ // nothing to show before the prompt, so show the prompt alone
+ let content = prompt_frame(title, subtitle, hold, danger, true, verb).with_external_menu();
+ // not `Frame::map`, which would pass on `FlowMsg::Next` from a tap on the
+ // footer, confirming without the hold
+ let content = MsgMap::new(content, |msg| match msg {
+ FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
+ FrameMsg::Button(FlowMsg::Info) => Some(FlowMsg::Info),
+ _ => None,
+ });
+ return super::util::single_page(content);
+ }
+
let paragraphs = {
let action = action.unwrap_or("".into());
let description = description.unwrap_or("".into());
@@ -308,7 +323,7 @@ pub fn new_confirm_action(
if external_menu && (prompt_screen || hold) {
return Err(Error::ValueError(
- c"external_menu currently not supported in tandem with prompt_screen/hold",
+ c"external_menu not supported with a tap prompt, nor with hold and action/description",
));
}
@@ -483,23 +498,50 @@ fn create_confirm(
prompt_title: TString<'static>,
prompt_state: &'static dyn FlowController,
) -> Result<(), Error> {
- let (prompt, prompt_action) = match (hold, danger) {
+ let content_confirm = prompt_frame(
+ prompt_title,
+ subtitle,
+ hold,
+ danger,
+ matches!(extra, ConfirmActionExtra::Menu(_)),
+ None,
+ )
+ .with_swipe(Direction::Down, SwipeSettings::Default);
+
+ flow.add_page(
+ prompt_state,
+ content_confirm.map(super::util::map_to_confirm),
+ )?;
+ Ok(())
+}
+
+// The "Tap to confirm" or "Hold to confirm" screen, `instruction` overrides its
+// footer.
+fn prompt_frame(
+ title: TString<'static>,
+ subtitle: Option<TString<'static>>,
+ hold: bool,
+ danger: bool,
+ menu_button: bool,
+ instruction: Option<TString<'static>>,
+) -> Frame<SwipeContent<PromptScreen>> {
+ let (prompt, default_instruction) = match (hold, danger) {
(true, false) => (
PromptScreen::new_hold_to_confirm(),
- TR::instructions__hold_to_confirm.into(),
+ TR::instructions__hold_to_confirm,
),
(true, true) => (
PromptScreen::new_hold_to_confirm_danger(),
- TR::instructions__hold_to_confirm.into(),
+ TR::instructions__hold_to_confirm,
),
(false, _) => (
PromptScreen::new_tap_to_confirm(),
- TR::instructions__tap_to_confirm.into(),
+ TR::instructions__tap_to_confirm,
),
};
- let mut header = Header::left_aligned(prompt_title);
- if matches!(extra, ConfirmActionExtra::Menu(_)) {
+ let mut header = Header::left_aligned(title);
+ if menu_button {
header = header.with_menu_button();
}
if danger {
@@ -508,15 +550,8 @@ fn create_confirm(
if let Some(subtitle) = subtitle {
header = header.with_subtitle(subtitle);
}
- let content_confirm = Frame::with_header(header, SwipeContent::new(prompt))
- .with_footer(prompt_action, None)
- .with_swipe(Direction::Down, SwipeSettings::Default);
-
- flow.add_page(
- prompt_state,
- content_confirm.map(super::util::map_to_confirm),
- )?;
- Ok(())
+ Frame::with_header(header, SwipeContent::new(prompt))
+ .with_footer(instruction.unwrap_or(default_instruction.into()), None)
}
fn danger_header(header: Header) -> Header {
### core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
@@ -51,7 +51,7 @@ impl FirmwareUI for UIDelizia {
action: Option<TString<'static>>,
description: Option<TString<'static>>,
subtitle: Option<TString<'static>>,
- _verb: Option<TString<'static>>,
+ verb: Option<TString<'static>>,
_cancel: bool,
verb_cancel: Option<TString<'static>>,
hold: bool,
@@ -66,6 +66,7 @@ impl FirmwareUI for UIDelizia {
action,
description,
subtitle,
+ verb,
if external_menu { None } else { verb_cancel },
reverse,
hold,
### core/mocks/generated/trezorui_api.pyi
@@ -162,7 +162,8 @@ def confirm_action(
prompt_title: str | None = None,
external_menu: bool = False,
) -> LayoutContext[UiResult]:
- """Confirm action."""
+ """Confirm action. Delizia: with an external menu and no text, only the hold prompt
+ is shown."""
# rust/src/ui/api/firmware_micropython.rsWhy this scored 16/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.