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

PPOM - Signature Metric events have the flagged_as_malicious and Blockaid info when using a different network than Mainnet #8282

Merged
merged 6 commits into from
Jan 24, 2024

Conversation

segun
Copy link
Contributor

@segun segun commented Jan 15, 2024

Description

Whenever I am on a different network than Mainnet (i.e. Sepolia) if I perform signatures from the test dapp I can see how the metrics information for that event displays PPOM information (i.e. flagged as malicious, reason, RPC counts, etc).

Analytics 'trackEventWithParameters' - {"category": "Signature Rejected"} {"account_type": "MetaMask", "chain_id": "11155111", "dapp_host_name": "metamask.github.io", "ppom_debug_traceCall_count": 1, "ppom_eth_call_count": 12, "ppom_eth_getBalance_count": 1, "ppom_eth_getBlockByNumber_count": 1, "request_platform": undefined, "request_source": "In-App-Browser", "security_alert_reason": "seaport_farming", "security_alert_response": "Malicious", "signature_type": "eth_signTypedData_v4", "ui_customizations": ["flagged_as_malicious"], "version": "V4"}
Expected behavior

For not supported networks, we should see the same as we see in Extension:

security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',

and no RPC counts

The direction taken in this solution is to create a supported networks list (with only mainnet for now) and check if the current chainId is in supported networks.

I think this will make multichain support easier to add/implement when we are ready to go to multichain

Related issues

Fixes: #8065

Manual testing steps

  1. Launch MM
  2. Make sure yarn watch is running
  3. Open testdapp and switch to any network other than mainnet
  4. Do a PPOM signature request from testdapp
  5. Cancel it
  6. Open Terminal running yarn watch and see that PPOM security alert metrics are sent
  7. Checkout this branch
  8. Repeat Steps 2-6, but noticed NotApplicable are now sent in metrics now.

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.

@segun segun added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-confirmations-secure-ux-PR PR from the confirmations team labels Jan 15, 2024
@segun segun self-assigned this Jan 15, 2024
@segun segun requested a review from a team as a code owner January 15, 2024 21:30
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.

@segun segun force-pushed the olu/fix-signature-metric-events branch from 0d6b123 to c2d5914 Compare January 15, 2024 21:31
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jan 15, 2024
@segun segun added Run Smoke E2E and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Jan 15, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/64dcc985-bdc6-425b-be74-05d68487c138
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f791282) 40.21% compared to head (e36284b) 40.23%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8282      +/-   ##
==========================================
+ Coverage   40.21%   40.23%   +0.01%     
==========================================
  Files        1235     1235              
  Lines       29885    29894       +9     
  Branches     2863     2865       +2     
==========================================
+ Hits        12018    12027       +9     
  Misses      17176    17176              
  Partials      691      691              

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

app/util/blockaid/index.ts Outdated Show resolved Hide resolved
@segun segun force-pushed the olu/fix-signature-metric-events branch from 0cbb464 to e36284b Compare January 17, 2024 17:28
Copy link

sonarcloud bot commented Jan 17, 2024

@segun segun merged commit 5fa1dd8 into main Jan 24, 2024
27 checks passed
@segun segun deleted the olu/fix-signature-metric-events branch January 24, 2024 10:35
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 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 24, 2024
@metamaskbot metamaskbot added the release-7.16.0 Issue or pull request that will be included in release 7.16.0 label Jan 24, 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 team-confirmations-secure-ux-PR PR from the confirmations team
Projects
None yet
7 participants