From 39a8e6bb509ddbc486ec267793efdf384335a6d0 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 3 Feb 2023 11:34:38 +0100 Subject: [PATCH] tests(cosi): add invalid path tests --- tests/device_tests/misc/test_cosi.py | 16 ++++++++++++++++ tests/ui_tests/fixtures.json | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/device_tests/misc/test_cosi.py b/tests/device_tests/misc/test_cosi.py index b5e46ff2e..ed2a9dde0 100644 --- a/tests/device_tests/misc/test_cosi.py +++ b/tests/device_tests/misc/test_cosi.py @@ -136,3 +136,19 @@ def test_slip26_paths(client: Client, model: bytes): slip26_model = int.from_bytes(model, "little") path = Address([H_(10026), H_(slip26_model), H_(0), H_(0)]) cosi.commit(client, path) + + +@pytest.mark.parametrize( + "path", + ( + "m/44h/0h/0h/0/0", + "m/44h/60h/0h/0/0", + "m/44h/60h/1h", + "m/84h/60h/1h/0", + "m/1", + "m/10018/0", + ), +) +def test_invalid_path(client: Client, path: str) -> None: + with pytest.raises(TrezorFailure, match="DataError"): + cosi.commit(client, parse_path(path)) diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index ac9148d0e..11d7fdc06 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -415,6 +415,12 @@ "T1_misc-test_cosi.py::test_cosi_sign1": "6990c238036b79368fea1dc1e3e8871d7788322bbee7425d14c53623bc8182e8", "T1_misc-test_cosi.py::test_cosi_sign2": "0852e7433ec54a0ace301b683417107a9805095acd954010b665266503a79f36", "T1_misc-test_cosi.py::test_cosi_sign3": "d04fca2d97f7117ffc79ae52d192086aba2f9c64e89db27e20a930e9048f1d81", +"T1_misc-test_cosi.py::test_invalid_path[m-10018-0]": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", +"T1_misc-test_cosi.py::test_invalid_path[m-1]": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", +"T1_misc-test_cosi.py::test_invalid_path[m-44h-0h-0h-0-0]": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", +"T1_misc-test_cosi.py::test_invalid_path[m-44h-60h-0h-0-0]": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", +"T1_misc-test_cosi.py::test_invalid_path[m-44h-60h-1h]": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", +"T1_misc-test_cosi.py::test_invalid_path[m-84h-60h-1h-0]": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "T1_misc-test_msg_cipherkeyvalue.py::test_decrypt": "a849d9e11e222d1348ce3135680a2a61ed265692adeba4bd48af2fdc65207e61", "T1_misc-test_msg_cipherkeyvalue.py::test_decrypt_badlen": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "T1_misc-test_msg_cipherkeyvalue.py::test_encrypt": "e36d5b5db4b3733c9f484b149c0f966b3dd66e8b54e1b5bccf9da5cca7abed91", @@ -1441,6 +1447,12 @@ "TT_misc-test_cosi.py::test_cosi_sign1": "92799c53459f2a735a145bde35943967265d2411e766e5597d7f614f9ef1827c", "TT_misc-test_cosi.py::test_cosi_sign2": "59071f9bac86b8666b28c53178fbe76249af0878a5d9eafe4b40ea7b63a2a9e7", "TT_misc-test_cosi.py::test_cosi_sign3": "264dcf0ee58b1cc5a580ab5ab567a7450776c12002a87ea56c071b83a85bfc9c", +"TT_misc-test_cosi.py::test_invalid_path[m-10018-0]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", +"TT_misc-test_cosi.py::test_invalid_path[m-1]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", +"TT_misc-test_cosi.py::test_invalid_path[m-44h-0h-0h-0-0]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", +"TT_misc-test_cosi.py::test_invalid_path[m-44h-60h-0h-0-0]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", +"TT_misc-test_cosi.py::test_invalid_path[m-44h-60h-1h]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", +"TT_misc-test_cosi.py::test_invalid_path[m-84h-60h-1h-0]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", "TT_misc-test_cosi.py::test_slip26_paths[42]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", "TT_misc-test_cosi.py::test_slip26_paths[T1B1]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae", "TT_misc-test_cosi.py::test_slip26_paths[T2B1]": "bd83a31d0fc4c23953dfd0d138e4441984e34698ace96aad5308a4ae51b712ae",