fix(monero): set 'manage' JSON key explicitly when mnemonic type is not BIP 39
What changed, and why it matters
This commit fixes a small but meaningful bug in the Keystone 3 hardware wallet's account information output. Previously, when showing details for Monero (XMR), the 'manage' field was completely left out if the wallet's mnemonic type was not BIP 39. Now it is always included and set to false in that case. The change makes the JSON response predictable and consistent, which can help companion apps or users avoid misinterpreting whether the coin can be managed. It is a defensive fix rather than an obvious exploit, but omitting a boolean field could lead a connected app to make unsafe assumptions.
Treat as a low-to-moderate reliability/security hardening fix. Review any companion apps or SDKs that consume this JSON to confirm they handle both present and absent 'manage' keys safely, and verify that the new helper correctly reflects all supported mnemonic types for Monero. No urgent exploit mitigation is evident from the diff alone.
Security signals we found
Inconsistent JSON schema: a boolean field was omitted instead of set to false under a specific condition
Monero mnemonic-type support check now centralized in a dedicated helper
Pattern aligned with existing Zcash helper, suggesting a prior recognized need for explicit support flags
Potential downstream consumer confusion or unsafe defaulting if 'manage' key is missing
Evidence from the diff
In AccountPublicHomeCoinGet(), the code building a JSON description of each coin added a ‘manage’ key for every coin. For XMR, however, the key was only added when GetMnemonicType() == MNEMONIC_TYPE_BIP39; otherwise the key was absent. The patch introduces IsMoneroSupportedForCurrentMnemonic() (mirroring the existing IsZcashSupportedForCurrentMnemonic()) and always emits ‘manage’ for XMR, using that helper’s boolean result. This centralizes the mnemonic-type check and guarantees the JSON object has a consistent shape regardless of mnemonic type.
Changed components
src/crypto/account_public_info.csrc/managers/account_manager.csrc/managers/account_manager.hAccountPublicHomeCoinGet JSON serializationMonero (XMR) account management reportingInspect captured patch +8 / −3
diff --git a/src/crypto/account_public_info.c b/src/crypto/account_public_info.c
index 9f80754..68203fc 100644
--- a/src/crypto/account_public_info.c
+++ b/src/crypto/account_public_info.c
@@ -668,9 +668,8 @@ void AccountPublicHomeCoinGet(WalletState_t *walletList, uint8_t count)
cJSON_AddItemToObject(jsonItem, "manage",
cJSON_CreateBool(IsZcashSupportedForCurrentMnemonic()));
} else if (!strcmp(walletList[i].name, "XMR")) {
- if (GetMnemonicType() == MNEMONIC_TYPE_BIP39) {
- cJSON_AddItemToObject(jsonItem, "manage", cJSON_CreateBool(true));
- }
+ cJSON_AddItemToObject(jsonItem, "manage",
+ cJSON_CreateBool(IsMoneroSupportedForCurrentMnemonic()));
#endif
} else {
cJSON_AddItemToObject(jsonItem, "manage", cJSON_CreateBool(false));
diff --git a/src/managers/account_manager.c b/src/managers/account_manager.c
index 48f9a82..097f166 100644
--- a/src/managers/account_manager.c
+++ b/src/managers/account_manager.c
@@ -594,6 +594,11 @@ bool IsZcashSupportedForCurrentMnemonic(void)
return false;
}
+bool IsMoneroSupportedForCurrentMnemonic(void)
+{
+ return GetMnemonicType() == MNEMONIC_TYPE_BIP39;
+}
+
static void SetZcashUFVK(uint8_t accountIndex, const char* ufvk)
{
ASSERT(accountIndex <= 2);
diff --git a/src/managers/account_manager.h b/src/managers/account_manager.h
index feddd4d..aaac443 100644
--- a/src/managers/account_manager.h
+++ b/src/managers/account_manager.h
@@ -102,6 +102,7 @@ void AccountsDataCheck(void);
#ifndef BTC_ONLY
bool IsZcashSupportedForCurrentMnemonic(void);
+bool IsMoneroSupportedForCurrentMnemonic(void);
int32_t GetZcashUFVK(uint8_t accountIndex, char* outUFVK);
int32_t GetZcashSFP(uint8_t accountIndex, uint8_t* outSFP);
int32_t SetupZcashSFP(uint8_t accountIndex, const char* password);
Why this scored 35/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.