test: assert payment request securechip counts
What changed, and why it matters
This commit only adds test assertions to check that a secure chip event counter is incremented correctly during payment request validation. It does not change any production code, so it cannot introduce a security vulnerability or fix one directly.
No security action required. Treat as normal test-quality improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies unit tests in src/rust/bitbox02-rust/src/hww/api/payment_request.rs. It resets a mocked securechip event counter before calling validate_common() and then asserts the counter equals 2 afterward. This is purely a test-hardening change that verifies expected securechip counter behavior. No production firmware logic is altered.
Changed components
src/rust/bitbox02-rust/src/hww/api/payment_request.rs (unit tests only)Inspect captured patch +6 / −0
diff --git a/src/rust/bitbox02-rust/src/hww/api/payment_request.rs b/src/rust/bitbox02-rust/src/hww/api/payment_request.rs
index 7e2d2fc..109b43b 100644
--- a/src/rust/bitbox02-rust/src/hww/api/payment_request.rs
+++ b/src/rust/bitbox02-rust/src/hww/api/payment_request.rs
@@ -801,6 +801,7 @@ mod tests {
&value_bytes,
address,
);
+ mock_hal.securechip.event_counter_reset();
assert!(
validate_common(
&mut mock_hal,
@@ -812,6 +813,7 @@ mod tests {
.await
.is_ok()
);
+ assert_eq!(mock_hal.securechip.get_event_counter(), 2);
}
#[cfg(feature = "app-litecoin")]
@@ -874,6 +876,7 @@ mod tests {
&source_address,
);
+ mock_hal.securechip.event_counter_reset();
assert!(
validate_common(
&mut mock_hal,
@@ -885,6 +888,7 @@ mod tests {
.await
.is_ok()
);
+ assert_eq!(mock_hal.securechip.get_event_counter(), 2);
}
#[cfg(feature = "app-litecoin")]
@@ -947,6 +951,7 @@ mod tests {
&source_address,
);
+ mock_hal.securechip.event_counter_reset();
assert!(
validate_common(
&mut mock_hal,
@@ -958,6 +963,7 @@ mod tests {
.await
.is_ok()
);
+ assert_eq!(mock_hal.securechip.get_event_counter(), 2);
}
// Unhappy cases:
Why this scored 14/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.