process: require user to permit get_identity_shared_key RPC
What changed, and why it matters
This commit adds a user confirmation step before a hardware wallet will share an identity-derived shared secret. Previously, the get_identity_shared_key RPC could compute and return the shared key without the user pressing approve on the device. The change also rejects identity strings containing non-printable characters so the on-screen prompt cannot be tricked with hidden control characters. In short, the device now asks 'Share Identity Key?' and the user must tap accept before any secret is released.
Treat this as a security-hardening fix and include it in the next firmware release. Users should upgrade so that identity-shared-key operations require physical confirmation. Developers integrating with Jade should expect get_identity_shared_key to prompt the user and handle CBOR_RPC_USER_CANCELLED responses.
Security signals we found
RPC that derives/releases a cryptographic shared secret now requires explicit on-device user approval
Input validation added: identity string must be printable before being shown in a security prompt
New dedicated accept/reject button event IDs separate this flow from sign_identity
User cancellation now returns CBOR_RPC_USER_CANCELLED instead of silently proceeding
Documentation updated to note that the reply is delayed until user confirmation
Evidence from the diff
The patch modifies get_identity_shared_key_process() to call a new UI activity, show_get_identity_shared_key_activity(), and only proceeds to compute the ECDH shared secret if the user accepts. It also validates that the identity parameter is entirely printable using isprint() before displaying it, returning CBOR_RPC_BAD_PARAMETERS otherwise. The existing sign_identity UI code is refactored into a shared helper so both ‘Sign Identity’ and ‘Share Identity Key’ flows reuse the same confirmation pattern with distinct button-event IDs. Tests are updated to cover the printable-character restriction.
Changed components
main/process/get_identity_shared_key.cmain/ui/sign_identity.cmain/button_events.hdocs/index.rsttest_jade.pytests/rpc/data/low_level/bad_params.jsonInspect captured patch +70 / −11
### docs/index.rst
@@ -1318,6 +1318,8 @@ NOTE: currently this call only supports 'ssh://' and 'gpg://' using nist256p1 (s
get_identity_shared_key reply
-----------------------------
+* NOTE: The reply is not sent until the user has explicitly confirmed sharing the identity key on the hw.
+
.. code-block:: cbor
{
### main/button_events.h
@@ -39,6 +39,9 @@ typedef enum {
BTN_SIGNIDENTITY_REJECT,
BTN_SIGNIDENTITY_ACCEPT,
+ BTN_IDENTITY_SHARED_KEY_REJECT,
+ BTN_IDENTITY_SHARED_KEY_ACCEPT,
+
BTN_CANCEL_SIGNATURE,
BTN_ACCEPT_SIGNATURE,
### main/process/get_identity_shared_key.c
@@ -1,15 +1,20 @@
#ifndef AMALGAMATED_BUILD
+#include <ctype.h>
+
#include "../jade_assert.h"
#include "../keychain.h"
#include "../process.h"
#include "../ui.h"
#include "../utils/cbor_rpc.h"
+#include "../utils/util.h"
#include "../button_events.h"
#include "../identity.h"
#include "process_utils.h"
+bool show_get_identity_shared_key_activity(const char* identity, size_t identity_len);
+
void get_identity_shared_key_process(void* process_ptr)
{
JADE_LOGI("Starting: %d", xPortGetFreeHeapSize());
@@ -31,6 +36,12 @@ void get_identity_shared_key_process(void* process_ptr)
goto cleanup;
}
+ // Identity must be a string of printable characters (it is shown to the user for confirmation)
+ if (!string_n_all(identity, identity_len, isprint)) {
+ jade_process_reject_message(process, CBOR_RPC_BAD_PARAMETERS, "Invalid identity string");
+ goto cleanup;
+ }
+
const uint8_t* their_pubkey = NULL;
size_t their_pubkey_len = 0;
rpc_get_bytes_ptr("their_pubkey", ¶ms, &their_pubkey, &their_pubkey_len);
@@ -48,6 +59,16 @@ void get_identity_shared_key_process(void* process_ptr)
goto cleanup;
}
+ // User to confirm computing/revealing the shared secret for this identity
+ if (!show_get_identity_shared_key_activity(identity, identity_len)) {
+ JADE_LOGW("User declined to share identity key");
+ jade_process_reject_message(process, CBOR_RPC_USER_CANCELLED, "User declined to share identity key");
+ goto cleanup;
+ }
+ JADE_LOGD("User pressed accept");
+
+ display_processing_message_activity();
+
// Get identity pubkey - Note we use uncompressed keys in this api
uint8_t shared_key[SHA256_LEN];
if (!get_identity_shared_key(identity, identity_len, index, curve, curve_len, their_pubkey, their_pubkey_len,
### main/ui/sign_identity.c
@@ -3,16 +3,20 @@
#include "../ui.h"
#include "jade_assert.h"
-static gui_activity_t* make_sign_identity_activity(const char* identity)
+// Shared confirmation activity for a given identity string
+// The identity is displayed to the user, who must explicitly approve or reject
+static gui_activity_t* make_identity_activity(
+ const char* title, const char* identity, const int32_t reject_ev_id, const int32_t accept_ev_id)
{
+ JADE_ASSERT(title);
JADE_ASSERT(identity);
// third row, buttons
- btn_data_t hdrbtns[] = { { .txt = "=", .font = JADE_SYMBOLS_16x16_FONT, .ev_id = BTN_SIGNIDENTITY_REJECT },
- { .txt = "S", .font = VARIOUS_SYMBOLS_FONT, .ev_id = BTN_SIGNIDENTITY_ACCEPT /**/ BTN_IS_CRITICAL } };
+ btn_data_t hdrbtns[] = { { .txt = "=", .font = JADE_SYMBOLS_16x16_FONT, .ev_id = reject_ev_id },
+ { .txt = "S", .font = VARIOUS_SYMBOLS_FONT, .ev_id = accept_ev_id /**/ BTN_IS_CRITICAL } };
gui_activity_t* const act = gui_make_activity();
- gui_view_node_t* const parent = add_title_bar(act, "Sign Identity", hdrbtns, 2, NULL);
+ gui_view_node_t* const parent = add_title_bar(act, title, hdrbtns, 2, NULL);
gui_view_node_t* node;
gui_make_text(&node, identity, TFT_WHITE);
@@ -23,27 +27,39 @@ static gui_activity_t* make_sign_identity_activity(const char* identity)
return act;
}
-bool show_sign_identity_activity(const char* identity, const size_t identity_len)
+static bool show_identity_activity(const char* title, const char* identity, const size_t identity_len,
+ const int32_t reject_ev_id, const int32_t accept_ev_id)
{
+ JADE_ASSERT(title);
JADE_ASSERT(identity);
JADE_ASSERT(identity_len < MAX_DISPLAY_MESSAGE_LEN);
char display_str[MAX_DISPLAY_MESSAGE_LEN];
int ret = snprintf(display_str, sizeof(display_str), "%.*s", identity_len, identity);
JADE_ASSERT(ret > 0 && ret < sizeof(display_str));
- gui_activity_t* const act = make_sign_identity_activity(display_str);
+ gui_activity_t* const act = make_identity_activity(title, display_str, reject_ev_id, accept_ev_id);
gui_set_current_activity(act);
while (true) {
- const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNIDENTITY_ACCEPT);
- switch (ev_id) {
- case BTN_SIGNIDENTITY_REJECT:
+ const int32_t ev_id = gui_activity_wait_button(act, accept_ev_id);
+ if (ev_id == reject_ev_id) {
return false;
-
- case BTN_SIGNIDENTITY_ACCEPT:
+ } else if (ev_id == accept_ev_id) {
return true;
}
}
}
+
+bool show_sign_identity_activity(const char* identity, const size_t identity_len)
+{
+ return show_identity_activity(
+ "Sign Identity", identity, identity_len, BTN_SIGNIDENTITY_REJECT, BTN_SIGNIDENTITY_ACCEPT);
+}
+
+bool show_get_identity_shared_key_activity(const char* identity, const size_t identity_len)
+{
+ return show_identity_activity(
+ "Share Identity Key", identity, identity_len, BTN_IDENTITY_SHARED_KEY_REJECT, BTN_IDENTITY_SHARED_KEY_ACCEPT);
+}
#endif // AMALGAMATED_BUILD
### test_jade.py
@@ -1119,6 +1119,10 @@ def test_bad_params(jade):
{'identity': 'ssh://user@some.xyz.com', 'curve': 'nist256p1',
'their_pubkey': GOOD_ECDH_PUBKEY,
'index': 0xFFFFFFFF + 1}), 'extract valid index'),
+ (('badidshared16', 'get_identity_shared_key', # non-printable char
+ {'identity': 'ssh://user@some.xyz.com\n', 'curve': 'nist256p1',
+ 'their_pubkey': GOOD_ECDH_PUBKEY, 'index': 0}),
+ 'Invalid identity string'),
(('badsignid1', 'sign_identity'), 'Expecting parameters map'),
(('badsignid2', 'sign_identity',
### tests/rpc/data/low_level/bad_params.json
@@ -2664,6 +2664,19 @@
],
"extract valid index"
],
+ [
+ [
+ "badidshared16",
+ "get_identity_shared_key",
+ {
+ "identity": "ssh://user@some.xyz.com\n",
+ "curve": "nist256p1",
+ "their_pubkey": "00",
+ "index": 0
+ }
+ ],
+ "Invalid identity string"
+ ],
[
[
"badsignid1",Why this scored 62/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.