Repository: LedgerHQ/app-ethereum (language: python)

Issue:
B2CA-1619: Blind Signing friction
## Description

Please provide a detailed description of what was done in this PR.
(And mentioned if linked to an issue [docs](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue))

## Changes include

- [ ] Bugfix (non-breaking change that solves an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)
- [ ] Tests
- [ ] Documentation
- [ ] Other (for changes that might not fit in any category)

## Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it.

## Additional comments

Please post additional comments in this section if you have them, otherwise delete it.



Discussion / hints:

Fix patch:
diff --git a/src_bagl/ui_flow_signMessage712_v0.c b/src_bagl/ui_flow_signMessage712_v0.c
index 46cd039c8..e6ee1b359 100644
--- a/src_bagl/ui_flow_signMessage712_v0.c
+++ b/src_bagl/ui_flow_signMessage712_v0.c
@@ -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,
@@ -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,
@@ -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,
diff --git a/src_features/signMessageEIP712_v0/cmd_signMessage712.c b/src_features/signMessageEIP712_v0/cmd_signMessage712.c
index a5afa259a..844a3c8fc 100644
--- a/src_features/signMessageEIP712_v0/cmd_signMessage712.c
+++ b/src_features/signMessageEIP712_v0/cmd_signMessage712.c
@@ -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;
diff --git a/src_nbgl/ui_sign_712_v0.c b/src_nbgl/ui_sign_712_v0.c
index a3a39b7d2..4b8489e51 100644
--- a/src_nbgl/ui_sign_712_v0.c
+++ b/src_nbgl/ui_sign_712_v0.c
@@ -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);
 }


Test patch:
diff --git a/tests/ragger/test_eip712.py b/tests/ragger/test_eip712.py
index f2e98f9d4..7713883de 100644
--- a/tests/ragger/test_eip712.py
+++ b/tests/ragger/test_eip712.py
@@ -12,7 +12,6 @@
 from ragger.backend import BackendInterface
 from ragger.firmware import Firmware
 from ragger.navigator import Navigator, NavInsID, NavIns
-from ragger.navigator.navigation_scenario import NavigateWithScenario
 from ragger.error import ExceptionRAPDU
 
 import client.response_parser as ResponseParser
@@ -68,14 +67,27 @@ def get_wallet_addr(client: EthAppClient) -> bytes:
     return WALLET_ADDR
 
 
-def test_eip712_legacy(backend: BackendInterface, scenario_navigator: NavigateWithScenario):
+def test_eip712_v0(firmware: Firmware, backend: BackendInterface, navigator: Navigator):
     app_client = EthAppClient(backend)
 
+    settings_toggle(firmware, navigator, [SettingID.BLIND_SIGNING])
     with open(input_files()[0], encoding="utf-8") as file:
         data = json.load(file)
     smsg = encode_typed_data(full_message=data)
     with app_client.eip712_sign_legacy(BIP32_PATH, smsg.header, smsg.body):
-        scenario_navigator.review_approve(custom_screen_text="Sign", do_comparison=False)
+        moves = []
+        if firmware.is_nano:
+            moves += [NavInsID.RIGHT_CLICK] * 2
+            if firmware == Firmware.NANOS:
+                moves += [NavInsID.RIGHT_CLICK] * 8
+            else:
+                moves += [NavInsID.RIGHT_CLICK] * 4
+            moves += [NavInsID.BOTH_CLICK]
+        else:
+            moves += [NavInsID.USE_CASE_CHOICE_REJECT]
+            moves += [NavInsID.SWIPE_CENTER_TO_LEFT] * 2
+            moves += [NavInsID.USE_CASE_REVIEW_CONFIRM]
+        navigator.navigate(moves)
 
     vrs = ResponseParser.signature(app_client.response().data)
     recovered_addr = recover_message(data, vrs)