Skip to content

Commit

Permalink
fix: safer max text length for sign custom data
Browse files Browse the repository at this point in the history
  • Loading branch information
krigga committed Feb 23, 2024
1 parent 4d83e6a commit a610433
Show file tree
Hide file tree
Showing 29 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/CUSTOM_DATA.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ text#_ {n:#} data:(SnakeData ~n) = Text;
Ledger request format:
| Value | Length or type | Description |
| --- | --- | --- |
| `message` | 0-250 | ASCII-only message |
| `message` | 0-120 | ASCII-only message |

## App data (0x54b58535)

Expand Down
2 changes: 1 addition & 1 deletion src/sign_data/sign_data_deserialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define PLAINTEXT_REQUEST 0x754bf91b
#define APP_DATA_REQUEST 0x54b58535
#define MAX_PLAINTEXT_LENGTH 188
#define MAX_PLAINTEXT_LENGTH 120
#define MAX_APP_DATA_DOMAIN_LENGTH 126 // max allowed domain len as per TON DNS spec

#define SAFE(RES) \
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pytest
ragger[speculos,ledgerwallet]>=1.14.2
ragger[speculos,ledgerwallet]>=1.14.4
pysha3>=1.0.0,<2.0.0
tonsdk==1.0.13
ecdsa>=0.18.0
Expand Down
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos/test_sign_data/part0/00009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/snapshots/nanos/test_sign_data/part0/00010.png
Binary file not shown.
Binary file removed tests/snapshots/nanos/test_sign_data/part0/00011.png
Binary file not shown.
Binary file removed tests/snapshots/nanos/test_sign_data/part0/00012.png
Binary file not shown.
Binary file modified tests/snapshots/nanosp/test_sign_data/part0/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_sign_data/part0/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_sign_data/part0/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_sign_data/part0/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanosp/test_sign_data/part0/00005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/snapshots/nanosp/test_sign_data/part0/00006.png
Binary file not shown.
Binary file modified tests/snapshots/nanox/test_sign_data/part0/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox/test_sign_data/part0/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox/test_sign_data/part0/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox/test_sign_data/part0/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox/test_sign_data/part0/00005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/snapshots/nanox/test_sign_data/part0/00006.png
Binary file not shown.
Binary file modified tests/snapshots/stax/test_sign_data/part0/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/test_sign_custom_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_sign_data(firmware, backend, navigator, test_name):
pubkey = client.get_public_key(path=path).data

requests: List[SignDataRequest] = [
PlaintextSignDataRequest("a" * 188),
PlaintextSignDataRequest("a" * 120),
AppDataSignDataRequest(Cell(), address=Address("0:" + "0" * 64), domain="test.ton", ext=Cell())
]

Expand Down

0 comments on commit a610433

Please sign in to comment.