bitbox02-rust: compile mnemonic.rs again in testing
What changed, and why it matters
This commit fixes a build configuration mistake that caused a Rust source file to be skipped during automated testing. It does not change the actual firmware behavior in shipped devices; it only restores the test and lint coverage for the mnemonic (seed phrase) workflow code. There is no direct security vulnerability being patched here.
No immediate security action required. Treat as a normal quality/test-coverage fix. Consider reviewing whether the period of missing test coverage (since commit a1c553b20064b9d01985fd352b5b96e761d9ae95) allowed any latent bugs in mnemonic.rs to remain undetected, and run the restored tests and clippy to confirm the module is clean.
Security signals we found
No security-relevant code change in firmware runtime behavior
No memory safety, cryptographic, or authorization changes
Restores static analysis (clippy) and unit-test coverage for mnemonic handling code
No CVE, advisory, or vendor security disclosure referenced in commit
Evidence from the diff
The commit corrects a #[cfg_attr] directive in src/rust/bitbox02-rust/src/workflow.rs. Previously, when the c-unit-testing feature was enabled, the real mnemonic.rs module was replaced by a stub (mnemonic_c_unit_tests.rs) for all test builds. The new condition limits the stub replacement to builds where c-unit-testing is enabled and testing is not enabled, so the Rust unit-test and clippy runs again exercise the real mnemonic.rs. The changes inside mnemonic.rs are test-only adjustments: removing an unnecessary .into() conversion and switching test helpers from bitbox02::keystore to crate::bip39 so the tests compile and run under the restored configuration.
Changed components
src/rust/bitbox02-rust/src/workflow.rssrc/rust/bitbox02-rust/src/workflow/mnemonic.rsInspect captured patch +6 / −5
diff --git a/src/rust/bitbox02-rust/src/workflow.rs b/src/rust/bitbox02-rust/src/workflow.rs
index 20e005b..3867f72 100644
--- a/src/rust/bitbox02-rust/src/workflow.rs
+++ b/src/rust/bitbox02-rust/src/workflow.rs
@@ -3,7 +3,10 @@
pub mod cancel;
pub mod confirm;
pub mod menu;
-#[cfg_attr(feature = "c-unit-testing", path = "workflow/mnemonic_c_unit_tests.rs")]
+#[cfg_attr(
+ all(feature = "c-unit-testing", not(feature = "testing")),
+ path = "workflow/mnemonic_c_unit_tests.rs"
+)]
pub mod mnemonic;
pub mod orientation_screen;
pub mod pairing;
diff --git a/src/rust/bitbox02-rust/src/workflow/mnemonic.rs b/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
index 6df3dac..fddfee4 100644
--- a/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
+++ b/src/rust/bitbox02-rust/src/workflow/mnemonic.rs
@@ -355,7 +355,6 @@ pub async fn get(
preset,
)
.await
- .into()
};
match user_entry {
@@ -420,15 +419,14 @@ mod tests {
use super::*;
use alloc::boxed::Box;
- use bitbox02::testing::{Data, mock};
fn bruteforce_lastword(mnemonic: &[&str]) -> Vec<zeroize::Zeroizing<String>> {
let mut result = Vec::new();
for i in 0..BIP39_WORDLIST_LEN {
- let word = bitbox02::keystore::get_bip39_word(i).unwrap();
+ let word = crate::bip39::get_word(i).unwrap();
let mut m = mnemonic.to_vec();
m.push(&word);
- if bitbox02::keystore::bip39_mnemonic_to_seed(&m.join(" ")).is_ok() {
+ if crate::bip39::mnemonic_to_seed(&m.join(" ")).is_ok() {
result.push(word);
}
}
Why this scored 12/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.