@exodus/web3-ethereum 14.0.1 → 14.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -66,19 +66,18 @@ const isValidGasLimitValue = (value) => {
|
|
|
66
66
|
/*
|
|
67
67
|
A `personal_sign` message, as the bytes that will actually be signed.
|
|
68
68
|
|
|
69
|
-
Only a 0x-prefixed, even-length, fully hex string
|
|
70
|
-
|
|
71
|
-
string
|
|
72
|
-
|
|
73
|
-
screen has no 0x to strip, so it renders the digits literally while the old signer decoded
|
|
74
|
-
them.
|
|
69
|
+
Only a 0x-prefixed, even-length, fully hex string decodes as hex. Every other string is
|
|
70
|
+
signed as its utf8 bytes, like MetaMask. The approval screen is shown the raw request
|
|
71
|
+
string and applies the same rule, so the user authenticates exactly what they read. Bare
|
|
72
|
+
hex therefore signs the ascii digits, because that is what the screen renders.
|
|
75
73
|
*/
|
|
76
|
-
const
|
|
74
|
+
const HEX_PERSONAL_SIGN_MESSAGE = /^0x([0-9a-fA-F]{2})*$/;
|
|
77
75
|
const decodePersonalSignMessage = (message) => {
|
|
78
|
-
if (typeof message !== 'string'
|
|
76
|
+
if (typeof message !== 'string')
|
|
79
77
|
throw new InvalidInputError();
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
return HEX_PERSONAL_SIGN_MESSAGE.test(message)
|
|
79
|
+
? hex0xStringToBuffer(message)
|
|
80
|
+
: Buffer.from(message, 'utf8');
|
|
82
81
|
};
|
|
83
82
|
export function exposeHandlers(rpc, deps) {
|
|
84
83
|
const { chainId, isTrusted, isAutoApproved, ensureTrusted, ensureUntrusted, approveConnection, approveMessage, approveTransactions, forwardRequest, getSupportedChainIds = async () => [], getAddress, getEstimatedGas, getCustomFeeData, getFeeData, getNonce, sendRawTransaction, simulateEthereumTransactions, scanDomains, onTransactionsSigned = () => { }, onEthWalletWatchAssetRequest = () => { }, isUnlocked = () => true, ensureUnlocked = async () => true, getIsConnected, getAsset, addEthereumChain, getOrigin, getPathname, getActiveWalletAccountData, transactionSigner, messageSigner, } = deps;
|
|
@@ -204,18 +203,7 @@ export function exposeHandlers(rpc, deps) {
|
|
|
204
203
|
await assertTrusted();
|
|
205
204
|
await ensureUnlocked();
|
|
206
205
|
// The approval screen is handed this exact string, so the bytes we sign have to be
|
|
207
|
-
// derivable from it under ONE rule that the screen shares
|
|
208
|
-
// 0x-prefixed hex string; the signer used to hex-decode whatever it was given, which
|
|
209
|
-
// disagreed with the screen for any message that was not 0x-prefixed hex:
|
|
210
|
-
//
|
|
211
|
-
// `<hex of a SIWE login>` screen showed raw hex, we signed the login
|
|
212
|
-
// `<hex of a SIWE login> Login only.` screen showed the suffix, we dropped it
|
|
213
|
-
// `Sign in to example.com` screen showed the text, we signed nothing
|
|
214
|
-
//
|
|
215
|
-
// Each one let a dapp put readable text in front of the user and take a signature over
|
|
216
|
-
// something else. Requiring the prefix means a string the screen renders as text can
|
|
217
|
-
// never be reinterpreted as bytes, and decoding BEFORE approval means a message we
|
|
218
|
-
// would refuse is never approved in the first place.
|
|
206
|
+
// derivable from it under ONE rule that the screen shares (see HackerOne 4003290).
|
|
219
207
|
const rawMessage = decodePersonalSignMessage(message);
|
|
220
208
|
await approve(approveMessage, network, message);
|
|
221
209
|
const walletAccount = await getActiveWalletAccountData();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/web3-ethereum",
|
|
3
3
|
"description": "Apps connectivity library for EVM-compatible chains.",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test": "exodus-test --jest --esbuild"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@exodus/ethereum-api": "^
|
|
41
|
+
"@exodus/ethereum-api": "^10.0.0",
|
|
42
42
|
"@exodus/ethereumjs": "^1.11.0",
|
|
43
43
|
"@exodus/web3-constants": "^1.30.0",
|
|
44
44
|
"@exodus/web3-errors": "^1.13.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aweb3-ethereum"
|
|
69
69
|
},
|
|
70
70
|
"homepage": "https://github.com/ExodusMovement/assets/tree/master/web3/web3-ethereum",
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "7b9cb0164f443d87efabbf5a5dcb186d7fe3200c"
|
|
72
72
|
}
|