build(core): exclude `FirmwareUI::confirm_fido()` in BTC-only builds
What changed, and why it matters
This commit is a build cleanup, not a security fix. It makes sure the FIDO (WebAuthn/passwordless login) confirmation screen is only compiled into the universal firmware that supports altcoins and FIDO, and is left out of the smaller Bitcoin-only firmware build. Previously the code was included in all builds but returned a 'not implemented' error on Bitcoin-only devices. The change reduces unused code and build size; it does not patch a vulnerability or change runtime behavior in a security-relevant way.
No security action required. Treat as a normal build/maintenance commit. If auditing, verify that BTC-only builds still fail safely when FIDO-related Python apps are invoked, but the diff already shows `NotImplementedError` is returned.
Security signals we found
No memory-safety, authentication, cryptographic, or authorization changes
No new attack surface introduced
No bug fix or vulnerability remediation visible in diff
Feature gating reduces compiled code in BTC-only variant
Evidence from the diff
The change gates FirmwareUI::confirm_fido() and its supporting components/flows behind the universal_fw Cargo feature. In firmware_micropython.rs, the Python-exposed new_confirm_fido now returns Error::NotImplementedError for non-universal builds instead of calling into a method that itself returned the same error. Layout-specific implementations (bolt, caesar, delizia, eckhart) move the #[cfg(feature = "universal_fw")] attribute to the trait method and remove now-dead conditional branches and pub use re-exports. This is a compile-time dead-code elimination refactor.
Changed components
core/embed/rust/src/ui/api/firmware_micropython.rscore/embed/rust/src/ui/layout_bolt/ui_firmware.rscore/embed/rust/src/ui/layout_caesar/ui_firmware.rscore/embed/rust/src/ui/layout_delizia/flow/mod.rscore/embed/rust/src/ui/layout_delizia/ui_firmware.rscore/embed/rust/src/ui/layout_eckhart/flow/mod.rscore/embed/rust/src/ui/layout_eckhart/ui_firmware.rscore/embed/rust/src/ui/ui_firmware.rsInspect captured patch +15 / −15
### core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -264,6 +264,7 @@ extern "C" fn new_confirm_emphasized(n_args: usize, args: *const Obj, kwargs: *m
}
extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
+ #[cfg(feature = "universal_fw")]
let block = move |_args: &[Obj], kwargs: &Map| {
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
let app_name: TString = kwargs.get(Qstr::MP_QSTR_app_name)?.try_into()?;
@@ -273,6 +274,8 @@ extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map
let layout = ModelUI::confirm_fido(title, app_name, icon, accounts)?;
Ok(LayoutObj::new_root(layout)?.into())
};
+ #[cfg(not(feature = "universal_fw"))]
+ let block = |_args: &[Obj], _kwargs: &Map| Err(Error::NotImplementedError);
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
### core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
@@ -1,10 +1,12 @@
use core::cmp::Ordering;
+#[cfg(feature = "universal_fw")]
+use super::component::FidoConfirm;
use super::component::{
check_homescreen_format, AddressDetails, Bip39Input, Button, ButtonMsg, ButtonPage,
- ButtonStyleSheet, CancelConfirmMsg, CoinJoinProgress, Dialog, FidoConfirm, Frame, Homescreen,
- IconDialog, Lockscreen, MnemonicKeyboard, NumberInputDialog, PassphraseKeyboard, PinKeyboard,
- Progress, SelectMenu, SelectWordCount, SelectWordCountLayout, SetBrightnessDialog, ShareWords,
+ ButtonStyleSheet, CancelConfirmMsg, CoinJoinProgress, Dialog, Frame, Homescreen, IconDialog,
+ Lockscreen, MnemonicKeyboard, NumberInputDialog, PassphraseKeyboard, PinKeyboard, Progress,
+ SelectMenu, SelectWordCount, SelectWordCountLayout, SetBrightnessDialog, ShareWords,
SimplePage, Slip39Input,
};
use super::{fonts, theme, UIBolt};
@@ -223,6 +225,7 @@ impl FirmwareUI for UIBolt {
Ok(layout)
}
+ #[cfg(feature = "universal_fw")]
fn confirm_fido(
title: TString<'static>,
app_name: TString<'static>,
### core/embed/rust/src/ui/layout_caesar/ui_firmware.rs
@@ -239,6 +239,7 @@ impl FirmwareUI for UICaesar {
Err::<RootComponent<Empty, ModelUI>, Error>(Error::NotImplementedError)
}
+ #[cfg(feature = "universal_fw")]
fn confirm_fido(
title: TString<'static>,
app_name: TString<'static>,
### core/embed/rust/src/ui/layout_delizia/flow/mod.rs
@@ -21,8 +21,6 @@ pub use confirm_action::{
new_confirm_action, new_confirm_action_simple, ConfirmActionExtra, ConfirmActionMenuStrings,
ConfirmActionOptions, ConfirmActionStrings,
};
-#[cfg(feature = "universal_fw")]
-pub use confirm_fido::new_confirm_fido;
pub use confirm_firmware_update::new_confirm_firmware_update;
pub use confirm_homescreen::new_confirm_homescreen;
pub use confirm_reset::new_confirm_reset;
### core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
@@ -275,16 +275,14 @@ impl FirmwareUI for UIDelizia {
Ok(flow)
}
+ #[cfg(feature = "universal_fw")]
fn confirm_fido(
title: TString<'static>,
app_name: TString<'static>,
icon: Option<TString<'static>>,
accounts: Gc<List>,
) -> Result<impl LayoutMaybeTrace, Error> {
- #[cfg(feature = "universal_fw")]
- return flow::confirm_fido::new_confirm_fido(title, app_name, icon, accounts);
- #[cfg(not(feature = "universal_fw"))]
- Err::<RootComponent<Empty, ModelUI>, Error>(Error::NotImplementedError)
+ flow::confirm_fido::new_confirm_fido(title, app_name, icon, accounts)
}
fn confirm_firmware_update(
### core/embed/rust/src/ui/layout_eckhart/flow/mod.rs
@@ -17,8 +17,6 @@ pub mod show_thp_pairing_code;
pub mod show_tutorial;
pub mod util;
-#[cfg(feature = "universal_fw")]
-pub use confirm_fido::new_confirm_fido;
pub use confirm_firmware_update::new_confirm_firmware_update;
pub use confirm_reset::new_confirm_reset;
pub use confirm_set_new_code::new_set_new_code;
### core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs
@@ -208,16 +208,14 @@ impl FirmwareUI for UIEckhart {
Ok(layout)
}
+ #[cfg(feature = "universal_fw")]
fn confirm_fido(
title: TString<'static>,
app_name: TString<'static>,
icon: Option<TString<'static>>,
accounts: Gc<List>,
) -> Result<impl LayoutMaybeTrace, Error> {
- #[cfg(feature = "universal_fw")]
- return flow::confirm_fido::new_confirm_fido(title, app_name, icon, accounts);
- #[cfg(not(feature = "universal_fw"))]
- Err::<RootComponent<Empty, ModelUI>, Error>(Error::NotImplementedError)
+ flow::confirm_fido::new_confirm_fido(title, app_name, icon, accounts)
}
fn confirm_firmware_update(
### core/embed/rust/src/ui/ui_firmware.rs
@@ -216,6 +216,7 @@ pub trait FirmwareUI {
verb: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error>;
+ #[cfg(feature = "universal_fw")]
fn confirm_fido(
title: TString<'static>,
app_name: TString<'static>,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.