Skip to content

Commit ef971f0

Browse files
authored
Merge pull request #31612 from MetaMask/Version-v12.15.2
Version v12.15.2 RC
2 parents 7529c31 + 035c299 commit ef971f0

11 files changed

+178
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
diff --git a/dist/utils/validation.cjs b/dist/utils/validation.cjs
2+
index eb116f75643a6607af10eb1669aaabfb48159826..349937fca246b26deac4a428fb3ad93dc7e18a6e 100644
3+
--- a/dist/utils/validation.cjs
4+
+++ b/dist/utils/validation.cjs
5+
@@ -150,7 +150,9 @@ function validateAddress(address, propertyName) {
6+
function validateVerifyingContract({ data, internalAccounts, origin, }) {
7+
const verifyingContract = data?.domain?.verifyingContract;
8+
const isExternal = origin && origin !== approval_controller_1.ORIGIN_METAMASK;
9+
- if (isExternal &&
10+
+ if (verifyingContract &&
11+
+ typeof verifyingContract === 'string' &&
12+
+ isExternal &&
13+
internalAccounts.some((internalAccount) => internalAccount.toLowerCase() === verifyingContract.toLowerCase())) {
14+
throw new Error(`External signature requests cannot use internal accounts as the verifying contract.`);
15+
}
16+
diff --git a/dist/utils/validation.mjs b/dist/utils/validation.mjs
17+
index 58b55c134527537c0ef1f44876afcf2939e9ed53..d4af6e8a1e8fff08e422ebfa6b9f444dc24c8632 100644
18+
--- a/dist/utils/validation.mjs
19+
+++ b/dist/utils/validation.mjs
20+
@@ -145,7 +145,9 @@ function validateAddress(address, propertyName) {
21+
function validateVerifyingContract({ data, internalAccounts, origin, }) {
22+
const verifyingContract = data?.domain?.verifyingContract;
23+
const isExternal = origin && origin !== ORIGIN_METAMASK;
24+
- if (isExternal &&
25+
+ if (verifyingContract &&
26+
+ typeof verifyingContract === 'string' &&
27+
+ isExternal &&
28+
internalAccounts.some((internalAccount) => internalAccount.toLowerCase() === verifyingContract.toLowerCase())) {
29+
throw new Error(`External signature requests cannot use internal accounts as the verifying contract.`);
30+
}

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [12.15.2]
10+
### Added
11+
- Add icon image for Lens network ([#31638](https://github.com/MetaMask/metamask-extension/pull/31638))
12+
13+
### Fixed
14+
- Allow verifyingContract to be omitted from EIP-712 signatures ([#31613](https://github.com/MetaMask/metamask-extension/pull/31613))
15+
916
## [12.15.1]
1017
### Fixed
1118
- Re-fix state corruption resulting in inability to create/add accounts – previously fixed in 12.14.2 ([31274])(https://github.com/MetaMask/metamask-extension/pull/31274))
@@ -5884,7 +5891,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
58845891
- Added the ability to restore accounts from seed words.
58855892

58865893

5887-
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.15.1...HEAD
5894+
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.15.2...HEAD
5895+
[12.15.2]: https://github.com/MetaMask/metamask-extension/compare/v12.15.1...v12.15.2
58885896
[12.15.1]: https://github.com/MetaMask/metamask-extension/compare/v12.15.0...v12.15.1
58895897
[12.15.0]: https://github.com/MetaMask/metamask-extension/compare/v12.14.2...v12.15.0
58905898
[12.14.2]: https://github.com/MetaMask/metamask-extension/compare/v12.14.1...v12.14.2

app/images/lens-native.svg

+22
Loading

app/images/lens.png

35.3 KB
Loading

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "metamask-crx",
3-
"version": "12.15.1",
3+
"version": "12.15.2",
44
"private": true,
55
"repository": {
66
"type": "git",
@@ -318,7 +318,7 @@
318318
"@metamask/safe-event-emitter": "^3.1.1",
319319
"@metamask/scure-bip39": "^2.0.3",
320320
"@metamask/selected-network-controller": "^19.0.0",
321-
"@metamask/signature-controller": "^26.0.0",
321+
"@metamask/signature-controller": "patch:@metamask/signature-controller@npm%3A26.0.0#~/.yarn/patches/@metamask-signature-controller-npm-26.0.0-ecbc8b6cda.patch",
322322
"@metamask/smart-transactions-controller": "^16.1.0",
323323
"@metamask/snaps-controllers": "^10.0.1",
324324
"@metamask/snaps-execution-environments": "^7.0.0",

shared/constants/network.ts

+9
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export const CHAIN_IDS = {
181181
MODE_SEPOLIA: '0x397',
182182
MODE: '0x868b',
183183
MEGAETH_TESTNET: '0x18c6',
184+
LENS: '0xe8',
184185
} as const;
185186

186187
export const CHAINLIST_CHAIN_IDS_MAP = {
@@ -306,6 +307,7 @@ export const INK_DISPLAY_NAME = 'Ink Mainnet';
306307
export const SONEIUM_DISPLAY_NAME = 'Soneium Mainnet';
307308
export const MODE_SEPOLIA_DISPLAY_NAME = 'Mode Sepolia';
308309
export const MODE_DISPLAY_NAME = 'Mode Mainnet';
310+
export const LENS_DISPLAY_NAME = 'Lens';
309311

310312
export const infuraProjectId = process.env.INFURA_PROJECT_ID;
311313
export const getRpcUrl = ({
@@ -362,6 +364,7 @@ export const CURRENCY_SYMBOLS = {
362364
GLIMMER: 'GLMR',
363365
MOONRIVER: 'MOVR',
364366
ONE: 'ONE',
367+
LENS: 'GHO',
365368
} as const;
366369

367370
// Non-EVM currency symbols
@@ -529,6 +532,8 @@ export const MODE_SEPOLIA_IMAGE_URL = './images/mode-sepolia.svg';
529532
export const MODE_IMAGE_URL = './images/mode.svg';
530533
export const UNICHAIN_IMAGE_URL = './images/unichain.svg';
531534
export const MEGAETH_TESTNET_IMAGE_URL = './images/MegaETH-logo-testnet.png';
535+
export const LENS_IMAGE_URL = './images/lens.png';
536+
export const LENS_NATIVE_TOKEN_IMAGE_URL = './images/lens-native.svg';
532537

533538
export const INFURA_PROVIDER_TYPES = [
534539
NETWORK_TYPES.MAINNET,
@@ -650,6 +655,7 @@ export const NETWORK_TO_NAME_MAP = {
650655
[CHAIN_IDS.LISK]: LISK_DISPLAY_NAME,
651656
[CHAIN_IDS.LISK_SEPOLIA]: LISK_SEPOLIA_DISPLAY_NAME,
652657
[CHAIN_IDS.MEGAETH_TESTNET]: MEGAETH_TESTNET_DISPLAY_NAME,
658+
[CHAIN_IDS.LENS]: LENS_DISPLAY_NAME,
653659
} as const;
654660

655661
export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = {
@@ -777,6 +783,7 @@ export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = {
777783
CHAINLIST_CURRENCY_SYMBOLS_MAP.SONEIUM_TESTNET,
778784
[CHAINLIST_CHAIN_IDS_MAP.MEGAETH_TESTNET]:
779785
TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.MEGAETH_TESTNET],
786+
[CHAIN_IDS.LENS]: CURRENCY_SYMBOLS.LENS,
780787
} as const;
781788

782789
/**
@@ -909,6 +916,7 @@ export const CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP: Record<Hex, string> = {
909916
[CHAINLIST_CHAIN_IDS_MAP.MODE]: MODE_IMAGE_URL,
910917
[CHAINLIST_CHAIN_IDS_MAP.UNICHAIN]: UNICHAIN_IMAGE_URL,
911918
[CHAINLIST_CHAIN_IDS_MAP.UNICHAIN_SEPOLIA]: UNICHAIN_IMAGE_URL,
919+
[CHAIN_IDS.LENS]: LENS_IMAGE_URL,
912920
} as const;
913921

914922
export const CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP = {
@@ -958,6 +966,7 @@ export const CHAIN_ID_TOKEN_IMAGE_MAP = {
958966
[CHAINLIST_CHAIN_IDS_MAP.FUNKICHAIN]: ETH_TOKEN_IMAGE_URL,
959967
[CHAINLIST_CHAIN_IDS_MAP.UNICHAIN]: ETH_TOKEN_IMAGE_URL,
960968
[CHAINLIST_CHAIN_IDS_MAP.UNICHAIN_SEPOLIA]: ETH_TOKEN_IMAGE_URL,
969+
[CHAIN_IDS.LENS]: LENS_NATIVE_TOKEN_IMAGE_URL,
961970
} as const;
962971

963972
export const INFURA_BLOCKED_KEY = 'countryBlocked';

test/e2e/tests/ppom/ppom-blockaid-alert-simple-send.spec.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,18 @@ async function mockInfuraWithBenignResponses(mockServer) {
7070

7171
async function mockInfuraWithMaliciousResponses(mockServer) {
7272
await mockInfura(mockServer);
73+
const requestMock = {
74+
method: 'eth_sendTransaction',
75+
params: [
76+
{
77+
from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1',
78+
to: '0x5fbdb2315678afecb367f032d93f642f64180aa3',
79+
value: '0x9184e72a000',
80+
},
81+
],
82+
};
7383

74-
await mockRequest(mockServer, SEND_REQUEST_BASE_MOCK, {
84+
await mockRequest(mockServer, requestMock, {
7585
block: 20733277,
7686
result_type: 'Malicious',
7787
reason: 'transfer_farming',

test/e2e/tests/ppom/ppom-blockaid-alert-trade-order-farming.spec.js

+25
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const FixtureBuilder = require('../../fixture-builder');
22

33
const { WINDOW_TITLES, unlockWallet, withFixtures } = require('../../helpers');
44
const { mockServerJsonRpc } = require('./mocks/mock-server-json-rpc');
5+
const { SECURITY_ALERTS_PROD_API_BASE_URL } = require('./constants');
56

67
const CONTRACT_ADDRESS = {
78
WrappedEther: 'c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
@@ -78,6 +79,30 @@ async function mockInfura(mockServer) {
7879
['eth_getCode'],
7980
['eth_getTransactionCount'],
8081
]);
82+
mockSecurityAlertsRequest(mockServer);
83+
}
84+
85+
async function mockSecurityAlertsRequest(server) {
86+
const request = {
87+
method: 'eth_signTypedData_v4',
88+
params: ['0x5cfe73b6021e818b776b421b1c4db2474086a7e1'],
89+
};
90+
91+
const response = {
92+
statusCode: 201,
93+
body: {
94+
block: 20733277,
95+
result_type: 'Malicious',
96+
reason: 'transfer_farming',
97+
description: '',
98+
features: ['Interaction with a known malicious address'],
99+
},
100+
};
101+
102+
await server
103+
.forPost(`${SECURITY_ALERTS_PROD_API_BASE_URL}/validate/0x1`)
104+
.withJsonBodyIncluding(request)
105+
.thenJson(response.statusCode ?? 201, response);
81106
}
82107

83108
describe('PPOM Blockaid Alert - Set Trade farming order', function () {

test/e2e/vault-decryption-chrome.spec.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path';
33
import fs from 'fs-extra';
44
import level from 'level';
55
import { Driver } from './webdriver/driver';
6-
import { withFixtures, WALLET_PASSWORD } from './helpers';
6+
import { WALLET_PASSWORD, WINDOW_TITLES, withFixtures } from './helpers';
77
import HeaderNavbar from './page-objects/pages/header-navbar';
88
import HomePage from './page-objects/pages/home/homepage';
99
import PrivacySettings from './page-objects/pages/settings/privacy-settings';
@@ -166,10 +166,11 @@ describe('Vault Decryptor Page', function () {
166166
await driver.waitUntilXWindowHandles(2);
167167

168168
// we cannot use the customized driver functions as there is no socket for window communications in prod builds
169-
const windowHandles = await driver.driver.getAllWindowHandles();
169+
await driver.switchToWindowByTitleWithoutSocket(
170+
WINDOW_TITLES.ExtensionInFullScreenView,
171+
);
170172

171173
// switch to MetaMask window and create a new vault through onboarding flow
172-
await driver.driver.switchTo().window(windowHandles[2]);
173174
await completeCreateNewWalletOnboardingFlowWithCustomSettings({
174175
driver,
175176
password: WALLET_PASSWORD,
@@ -224,10 +225,11 @@ describe('Vault Decryptor Page', function () {
224225
await driver.waitUntilXWindowHandles(2);
225226

226227
// we cannot use the customized driver functions as there is no socket for window communications in prod builds
227-
const windowHandles = await driver.driver.getAllWindowHandles();
228+
await driver.switchToWindowByTitleWithoutSocket(
229+
WINDOW_TITLES.ExtensionInFullScreenView,
230+
);
228231

229232
// switch to MetaMask window and create a new vault through onboarding flow
230-
await driver.driver.switchTo().window(windowHandles[2]);
231233
await completeCreateNewWalletOnboardingFlowWithCustomSettings({
232234
driver,
233235
password: WALLET_PASSWORD,

test/e2e/webdriver/driver.js

+40
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,46 @@ class Driver {
12581258
}
12591259
}
12601260

1261+
/**
1262+
* Switches to a window by its title without using the background socket.
1263+
* To be used in specs that run against production builds.
1264+
*
1265+
* @param {string} title - The target window title to switch to
1266+
* @returns {Promise<void>}
1267+
* @throws {Error} Will throw an error if the target window is not found
1268+
*/
1269+
async switchToWindowByTitleWithoutSocket(title) {
1270+
const windowHandles = await this.driver.getAllWindowHandles();
1271+
let targetWindowFound = false;
1272+
1273+
// Iterate through each window handle
1274+
for (const handle of windowHandles) {
1275+
await this.driver.switchTo().window(handle);
1276+
let currentTitle = await this.driver.getTitle();
1277+
1278+
// Wait 25 x 200ms = 5 seconds for the title to match the target title
1279+
for (let i = 0; i < 25; i++) {
1280+
if (currentTitle === title) {
1281+
targetWindowFound = true;
1282+
console.log(`Switched to ${title} window`);
1283+
break;
1284+
}
1285+
await this.driver.sleep(200);
1286+
currentTitle = await this.driver.getTitle();
1287+
}
1288+
1289+
// If the target window is found, break out of the outer loop
1290+
if (targetWindowFound) {
1291+
break;
1292+
}
1293+
}
1294+
1295+
// If target window is not found, throw an error
1296+
if (!targetWindowFound) {
1297+
throw new Error(`${title} window not found`);
1298+
}
1299+
}
1300+
12611301
// Error handling
12621302

12631303
async verboseReportOnFailure(testTitle, error) {

yarn.lock

+23-2
Original file line numberDiff line numberDiff line change
@@ -6231,7 +6231,7 @@ __metadata:
62316231
languageName: node
62326232
linkType: hard
62336233

6234-
"@metamask/signature-controller@npm:^26.0.0":
6234+
"@metamask/signature-controller@npm:26.0.0":
62356235
version: 26.0.0
62366236
resolution: "@metamask/signature-controller@npm:26.0.0"
62376237
dependencies:
@@ -6252,6 +6252,27 @@ __metadata:
62526252
languageName: node
62536253
linkType: hard
62546254

6255+
"@metamask/signature-controller@patch:@metamask/signature-controller@npm%3A26.0.0#~/.yarn/patches/@metamask-signature-controller-npm-26.0.0-ecbc8b6cda.patch":
6256+
version: 26.0.0
6257+
resolution: "@metamask/signature-controller@patch:@metamask/signature-controller@npm%3A26.0.0#~/.yarn/patches/@metamask-signature-controller-npm-26.0.0-ecbc8b6cda.patch::version=26.0.0&hash=eeb7c7"
6258+
dependencies:
6259+
"@metamask/base-controller": "npm:^8.0.0"
6260+
"@metamask/controller-utils": "npm:^11.6.0"
6261+
"@metamask/eth-sig-util": "npm:^8.2.0"
6262+
"@metamask/utils": "npm:^11.2.0"
6263+
jsonschema: "npm:^1.4.1"
6264+
lodash: "npm:^4.17.21"
6265+
uuid: "npm:^8.3.2"
6266+
peerDependencies:
6267+
"@metamask/accounts-controller": ^26.0.0
6268+
"@metamask/approval-controller": ^7.0.0
6269+
"@metamask/keyring-controller": ^21.0.0
6270+
"@metamask/logging-controller": ^6.0.0
6271+
"@metamask/network-controller": ^22.0.0
6272+
checksum: 10/a2df7d134d1b8e48af9ef218c0011b8a41ca5dcbed23ce75cc089043950b5c95114bea223639230fc0197d81b1c89647bf99abad41b7368082aa829c2ff3aacd
6273+
languageName: node
6274+
linkType: hard
6275+
62556276
"@metamask/slip44@npm:^4.1.0":
62566277
version: 4.1.0
62576278
resolution: "@metamask/slip44@npm:4.1.0"
@@ -27309,7 +27330,7 @@ __metadata:
2730927330
"@metamask/safe-event-emitter": "npm:^3.1.1"
2731027331
"@metamask/scure-bip39": "npm:^2.0.3"
2731127332
"@metamask/selected-network-controller": "npm:^19.0.0"
27312-
"@metamask/signature-controller": "npm:^26.0.0"
27333+
"@metamask/signature-controller": "patch:@metamask/signature-controller@npm%3A26.0.0#~/.yarn/patches/@metamask-signature-controller-npm-26.0.0-ecbc8b6cda.patch"
2731327334
"@metamask/smart-transactions-controller": "npm:^16.1.0"
2731427335
"@metamask/snaps-controllers": "npm:^10.0.1"
2731527336
"@metamask/snaps-execution-environments": "npm:^7.0.0"

0 commit comments

Comments
 (0)