Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for security alerts on zkSync, Berachain, Scroll and Metachain One on extension #25555

Merged
merged 7 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
},
"dependencies": {
"@babel/runtime": "patch:@babel/runtime@npm%3A7.24.0#~/.yarn/patches/@babel-runtime-npm-7.24.0-7eb1dd11a2.patch",
"@blockaid/ppom_release": "^1.4.8",
"@blockaid/ppom_release": "^1.4.9",
"@contentful/rich-text-html-renderer": "^16.3.5",
"@ensdomains/content-hash": "^2.5.7",
"@ethereumjs/tx": "^4.1.1",
Expand Down Expand Up @@ -326,7 +326,7 @@
"@metamask/permission-log-controller": "^2.0.1",
"@metamask/phishing-controller": "^9.0.3",
"@metamask/post-message-stream": "^8.0.0",
"@metamask/ppom-validator": "^0.31.0",
"@metamask/ppom-validator": "^0.32.0",
"@metamask/providers": "^14.0.2",
"@metamask/queued-request-controller": "^2.0.0",
"@metamask/rate-limit-controller": "^5.0.1",
Expand Down
7 changes: 7 additions & 0 deletions shared/constants/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ export const CHAIN_IDS = {
CHZ: '0x15b38',
NUMBERS: '0x290b',
SEI: '0x531',
BERACHAIN: '0x138d5',
METACHAIN_ONE: '0x1b6e6',
} as const;

export const CHAINLIST_CHAIN_IDS_MAP = {
Expand Down Expand Up @@ -243,6 +245,8 @@ export const MOONRIVER_DISPLAY_NAME = 'Moonriver';
export const SCROLL_DISPLAY_NAME = 'Scroll';
export const SCROLL_SEPOLIA_DISPLAY_NAME = 'Scroll Sepolia';
export const OP_BNB_DISPLAY_NAME = 'opBNB';
export const BERACHAIN_DISPLAY_NAME = 'Berachain Artio';
export const METACHAIN_ONE_DISPLAY_NAME = 'Metachain One Mainnet';

export const infuraProjectId = process.env.INFURA_PROJECT_ID;
export const getRpcUrl = ({
Expand Down Expand Up @@ -534,6 +538,9 @@ export const NETWORK_TO_NAME_MAP = {
[CHAIN_IDS.SCROLL_SEPOLIA]: SCROLL_SEPOLIA_DISPLAY_NAME,
[CHAIN_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME,
[CHAIN_IDS.OPBNB]: OP_BNB_DISPLAY_NAME,
[CHAIN_IDS.ZKSYNC_ERA]: ZK_SYNC_ERA_DISPLAY_NAME,
[CHAIN_IDS.BERACHAIN]: BERACHAIN_DISPLAY_NAME,
[CHAIN_IDS.METACHAIN_ONE]: METACHAIN_ONE_DISPLAY_NAME,
} as const;

export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = {
Expand Down
4 changes: 4 additions & 0 deletions shared/constants/security-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export const SECURITY_PROVIDER_SUPPORTED_CHAIN_IDS: Hex[] = [
CHAIN_IDS.OPTIMISM,
CHAIN_IDS.POLYGON,
CHAIN_IDS.SEPOLIA,
CHAIN_IDS.ZKSYNC_ERA,
CHAIN_IDS.SCROLL,
CHAIN_IDS.BERACHAIN,
CHAIN_IDS.METACHAIN_ONE,
];

export const SECURITY_PROVIDER_EXCLUDED_TRANSACTION_TYPES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exports[`Blockaid Banner Alert should render 'danger' UI when securityAlertRespo
Something doesn't look right?
<a
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.8%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Malicious%22%7D&utm_source=metamask-ppom"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.9%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Malicious%22%7D&utm_source=metamask-ppom"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -151,7 +151,7 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp
Something doesn't look right?
<a
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.8%22%2C%22classification%22%3A%22error%22%2C%22resultType%22%3A%22Error%22%7D&utm_source=metamask-ppom"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.9%22%2C%22classification%22%3A%22error%22%2C%22resultType%22%3A%22Error%22%7D&utm_source=metamask-ppom"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -248,7 +248,7 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp
Something doesn't look right?
<a
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.8%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%7D&utm_source=metamask-ppom"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.9%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%7D&utm_source=metamask-ppom"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -346,7 +346,7 @@ exports[`Blockaid Banner Alert should render details section even when features
Something doesn't look right?
<a
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.8%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%7D&utm_source=metamask-ppom"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.9%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%7D&utm_source=metamask-ppom"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -457,7 +457,7 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = `
Something doesn't look right?
<a
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.8%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%2C%22reproduce%22%3A%22%5B%5C%22Operator%20is%20an%20EOA%5C%22%2C%5C%22Operator%20is%20untrusted%20according%20to%20previous%20activity%5C%22%5D%22%7D&utm_source=metamask-ppom"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.9%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%2C%22reproduce%22%3A%22%5B%5C%22Operator%20is%20an%20EOA%5C%22%2C%5C%22Operator%20is%20untrusted%20according%20to%20previous%20activity%5C%22%5D%22%7D&utm_source=metamask-ppom"
rel="noopener noreferrer"
target="_blank"
>
Expand Down Expand Up @@ -556,7 +556,7 @@ exports[`Blockaid Banner Alert should render link to report url 1`] = `
Something doesn't look right?
<a
class="mm-box mm-text mm-button-base mm-button-link mm-button-link--size-inherit mm-text--body-md-medium mm-box--padding-0 mm-box--padding-right-0 mm-box--padding-left-0 mm-box--display-inline-flex mm-box--justify-content-center mm-box--align-items-center mm-box--color-primary-default mm-box--background-color-transparent"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.8%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%7D&utm_source=metamask-ppom"
href="https://blockaid-false-positive-portal.metamask.io?data=%7B%22blockaidVersion%22%3A%221.4.9%22%2C%22classification%22%3A%22set_approval_for_all%22%2C%22resultType%22%3A%22Warning%22%7D&utm_source=metamask-ppom"
rel="noopener noreferrer"
target="_blank"
>
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1710,10 +1710,10 @@ __metadata:
languageName: node
linkType: hard

"@blockaid/ppom_release@npm:^1.4.8":
version: 1.4.8
resolution: "@blockaid/ppom_release@npm:1.4.8"
checksum: 10/a8b7e94e54fdfd4a0fdde096f9302c7bbba18eec7b02e1f1163ec3848d25f12b3a7ff41be3f949ef7b77317c611aaec680d15c50f51b1f03244e3b1c2b9c4aed
"@blockaid/ppom_release@npm:^1.4.9":
version: 1.4.9
resolution: "@blockaid/ppom_release@npm:1.4.9"
checksum: 10/5aff4d0397632eb875a96e5bf1d13ebb17b11a457a4fe5f1b9a6a80d4612be233d0c328ecf36fff4d126326b0ea555590e8112515c3df7703f79b376288d5559
languageName: node
linkType: hard

Expand Down Expand Up @@ -6048,9 +6048,9 @@ __metadata:
languageName: node
linkType: hard

"@metamask/ppom-validator@npm:^0.31.0":
version: 0.31.0
resolution: "@metamask/ppom-validator@npm:0.31.0"
"@metamask/ppom-validator@npm:^0.32.0":
version: 0.32.0
resolution: "@metamask/ppom-validator@npm:0.32.0"
dependencies:
"@metamask/base-controller": "npm:^3.0.0"
"@metamask/controller-utils": "npm:^8.0.1"
Expand All @@ -6061,7 +6061,7 @@ __metadata:
elliptic: "npm:^6.5.4"
eslint-plugin-n: "npm:^16.6.2"
json-rpc-random-id: "npm:^1.0.1"
checksum: 10/ed7b02384dddea8733a61672cd983f416b3842a597d4694b22c2b4fc9836400909e58c4c3a98901c78593d2c053e54ba8477deb7d0a8a0a67a61ce22faebd3e8
checksum: 10/6b88fc9b5dc4ddcff88c15aed96994f93a95c350ae522115415d44aa38da981bdbdee56c7889cb44992a08eff4bcaf6198516961d3a69ec3d7a83c8014748496
languageName: node
linkType: hard

Expand Down Expand Up @@ -25135,7 +25135,7 @@ __metadata:
"@babel/preset-typescript": "npm:^7.23.2"
"@babel/register": "npm:^7.22.15"
"@babel/runtime": "patch:@babel/runtime@npm%3A7.24.0#~/.yarn/patches/@babel-runtime-npm-7.24.0-7eb1dd11a2.patch"
"@blockaid/ppom_release": "npm:^1.4.8"
"@blockaid/ppom_release": "npm:^1.4.9"
"@contentful/rich-text-html-renderer": "npm:^16.3.5"
"@ensdomains/content-hash": "npm:^2.5.7"
"@ethereumjs/tx": "npm:^4.1.1"
Expand Down Expand Up @@ -25217,7 +25217,7 @@ __metadata:
"@metamask/phishing-controller": "npm:^9.0.3"
"@metamask/phishing-warning": "npm:^3.0.3"
"@metamask/post-message-stream": "npm:^8.0.0"
"@metamask/ppom-validator": "npm:^0.31.0"
"@metamask/ppom-validator": "npm:^0.32.0"
"@metamask/providers": "npm:^14.0.2"
"@metamask/queued-request-controller": "npm:^2.0.0"
"@metamask/rate-limit-controller": "npm:^5.0.1"
Expand Down