Skip to content

Commit

Permalink
Added friction to the EIP-712 v0 flow
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Sep 25, 2024
1 parent 59d1a54 commit 0831e84
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src_bagl/ui_flow_signMessage712_v0.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "common_712.h"
#include "uint_common.h"
#include "common_ui.h"
#include "ui_flow.h" // ux_warning_blind_signing_warn_step

void prepare_domain_hash_v0() {
array_bytes_string(strings.tmp.tmp,
Expand Down Expand Up @@ -59,8 +60,8 @@ UX_STEP_CB(
_approve_cb(),
{
&C_icon_validate_14,
"Sign",
"message",
"Accept risk",
"and sign",
});
UX_STEP_CB(
ux_sign_712_v0_flow_5_step,
Expand All @@ -74,6 +75,7 @@ UX_STEP_CB(
// clang-format on

UX_FLOW(ux_sign_712_v0_flow,
&ux_warning_blind_signing_warn_step,
&ux_sign_712_v0_flow_1_step,
&ux_sign_712_v0_flow_2_step,
&ux_sign_712_v0_flow_3_step,
Expand Down
4 changes: 4 additions & 0 deletions src_features/signMessageEIP712_v0/cmd_signMessage712.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ uint16_t handleSignEIP712Message_v0(uint8_t p1,
reset_app_context();
}

if (!N_storage.dataAllowed) {
ui_error_blind_signing();
return APDU_RESPONSE_INVALID_DATA;
}
workBuffer = parseBip32(workBuffer, &dataLength, &tmpCtx.messageSigningContext.bip32);
if ((workBuffer == NULL) || (dataLength < (KECCAK256_HASH_BYTESIZE * 2))) {
return APDU_RESPONSE_INVALID_DATA;
Expand Down
15 changes: 8 additions & 7 deletions src_nbgl/ui_sign_712_v0.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ void ui_sign_712_v0(void) {
pairs_list.pairs = pairs;
pairs_list.nbMaxLinesForValue = 0;

nbgl_useCaseReview(TYPE_MESSAGE,
&pairs_list,
&C_Review_64px,
TEXT_REVIEW_EIP712,
NULL,
TEXT_SIGN_EIP712,
ui_typed_message_review_choice);
nbgl_useCaseReviewBlindSigning(TYPE_TRANSACTION,
&pairs_list,
&C_Review_64px,
TEXT_REVIEW_EIP712,
NULL,
TEXT_BLIND_SIGN_EIP712,
NULL,
ui_typed_message_review_choice);
}

0 comments on commit 0831e84

Please sign in to comment.