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: enable support to Blockaid on custom networks on mobile #8292

Merged
merged 31 commits into from
Jan 25, 2024

Conversation

blackdevelopa
Copy link
Contributor

@blackdevelopa blackdevelopa commented Jan 16, 2024

Description

This is a follow up to #7547. Once this PR is merged, we'll be able to support additional networks on extension and we should enable the feature on them.

We should enabled it on the following networks:

Ethereum Mainnet (already done)
BNB chain
Polygon
Arbitrum
Optimism
Avalanche
Linea

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/1693

Manual testing steps

  1. Go to Settings >> Network
  2. Add custom networks
  3. Go to Settings >> Experimental
  4. See that blockaid toggle is only enabled for supported networks

Screenshots/Recordings

Before

After

http://recordit.co/jC95wVGXEi

Screen.Recording.2024-01-18.at.15.46.27.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@blackdevelopa blackdevelopa added DO-NOT-MERGE Pull requests that should not be merged team-confirmations-secure-ux-PR PR from the confirmations team labels Jan 16, 2024
@blackdevelopa blackdevelopa self-assigned this Jan 16, 2024
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

socket-security bot commented Jan 16, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/@metamask/ppom-validator@0.22.0, npm/react-native-quick-crypto@0.6.1

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

@blackdevelopa blackdevelopa changed the title Enable support to Blockaid on custom networks on mobile feat: enable support to Blockaid on custom networks on mobile Jan 18, 2024
@jpuri
Copy link
Contributor

jpuri commented Jan 19, 2024

@SocketSecurity ignore npm/react-native-quick-crypto@0.6.1
@SocketSecurity ignore npm/@metamask/ppom-validator@0.22.0

@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2024

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (5fa1dd8) 40.34% compared to head (f15f630) 40.37%.
Report is 8 commits behind head on main.

Files Patch % Lines
app/lib/ppom/ppom-storage-backend.ts 3.70% 25 Missing and 1 partial ⚠️
app/lib/ppom/PPOMView.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8292      +/-   ##
==========================================
+ Coverage   40.34%   40.37%   +0.02%     
==========================================
  Files        1235     1235              
  Lines       29957    29951       -6     
  Branches     2877     2876       -1     
==========================================
+ Hits        12087    12092       +5     
+ Misses      17175    17165      -10     
+ Partials      695      694       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

blackdevelopa and others added 13 commits January 23, 2024 02:16
## **Description**

Fix blockaid mobile multichain. Re-init PPOM instance on network switch.

## **Related issues**

Fixes: MetaMask/MetaMask-planning#1926

## **Manual testing steps**

1. Open app and enable blockaid
2. Switch to mainnet, wait for few seconds and go to test dapp to submit
malicious transaction - validation should work
3. Switch to any other network supported by blockaid and wait for few
seconds and go to test dapp to submit malicious transaction - validation
should work

## **Screenshots/Recordings**
NA

## **Pre-merge author checklist**

- [X] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [X] I've clearly explained what problem this PR is solving and how it
is solved.
- [X] I've linked related issues
- [X] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [X] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [X] I’ve properly set the pull request status:
  - [X] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: Sylva Elendu <iamsylvaelendu@gmail.com>
…twork coverage on mobile (#8327)

## **Description**

This is a follow up to
https://github.com/MetaMask/MetaMask-planning/issues/1693. Once that PR
is merged, we should adjust copy to communicate the support for custom
networks.

What's new copy should be updated to:
Steer clear of known scams while still preserving your privacy with
security alerts powered by Blockaid. This feature is available on
Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.

Always do your own due diligence before approving requests.

Settings copy should be updated to:
Privacy preserving - no data is shared with third parties. Available on
Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Optimism and Polygon.

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
jpuri
jpuri previously approved these changes Jan 23, 2024
@blackdevelopa blackdevelopa marked this pull request as ready for review January 23, 2024 16:08
@blackdevelopa blackdevelopa requested a review from a team as a code owner January 23, 2024 16:08
@blackdevelopa blackdevelopa added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) and removed DO-NOT-MERGE Pull requests that should not be merged labels Jan 23, 2024
jpuri
jpuri previously approved these changes Jan 24, 2024
@jpuri jpuri added the Run Smoke E2E Triggers smoke e2e on Bitrise label Jan 24, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/5e98ad0e-d7b1-4191-83fd-2c1792232630
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

jpuri
jpuri previously approved these changes Jan 25, 2024
Copy link

sonarcloud bot commented Jan 25, 2024

@blackdevelopa blackdevelopa merged commit 3dc8d32 into main Jan 25, 2024
26 checks passed
@blackdevelopa blackdevelopa deleted the 1963/blockaid_custom_network branch January 25, 2024 13:52
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 25, 2024
@metamaskbot metamaskbot added the release-7.16.0 Issue or pull request that will be included in release 7.16.0 label Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.16.0 Issue or pull request that will be included in release 7.16.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-confirmations-secure-ux-PR PR from the confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants