device_trezor: improve error message for view key export
What changed, and why it matters
This commit changes how Monero's Trezor hardware wallet integration handles one specific error. Previously, if a user cancelled the view-key export on their Trezor device, the code fell through to a generic 'Get secret keys exception' message and returned false. Now it immediately throws a clearer error: 'Key export rejected on device.' This is a user-experience and diagnostic improvement, not a fix for an exploitable security flaw.
No security action required. Treat as routine code-quality/user-experience improvement.
Security signals we found
No cryptographic or access-control changes
No memory-safety or input-validation changes
Error message is user-facing only
No privilege escalation or secret exposure introduced
Evidence from the diff
In src/device_trezor/device_trezor.cpp, a new catch block for exc::proto::CancelledException was inserted before the generic std::exception handler. It throws a CHECK_AND_ASSERT_THROW_MES with the literal ‘Key export rejected on device’. The generic handler remains for other exceptions. The change only affects error reporting/control flow for a user-initiated cancellation and does not alter cryptographic operations, access controls, or secret handling.
Changed components
src/device_trezor/device_trezor.cppTrezor hardware wallet integrationView key export error pathInspect captured patch +2 / −0
diff --git a/src/device_trezor/device_trezor.cpp b/src/device_trezor/device_trezor.cpp
index 5f1fd27..ac4677f 100644
--- a/src/device_trezor/device_trezor.cpp
+++ b/src/device_trezor/device_trezor.cpp
@@ -205,6 +205,8 @@ namespace trezor {
return true;
+ } catch(const exc::proto::CancelledException &){
+ CHECK_AND_ASSERT_THROW_MES(false, "Key export rejected on device");
} catch(std::exception const& e){
MERROR("Get secret keys exception: " << e.what());
return false;
Why this scored 17/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.