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 metrics to track where signature rejection occurred #26469

Merged
merged 26 commits into from
Aug 28, 2024

Conversation

pnarayanaswamy
Copy link
Contributor

@pnarayanaswamy pnarayanaswamy commented Aug 16, 2024

Add a property location to the Signature Rejected event depending on where it was rejected from.
location: confirmation or alert_friction_modal

Description

Open in GitHub Codespaces

Related issues

Fixes: #2703

Manual testing steps

NOTE: All scenarios below have an E2E test in place along with this PR.

TC1:

  1. Go to the test dapp
  2. Initiate any signature
  3. Reject it from the confirmation screen
  4. Look for the Signature Rejected event in the network tab, the request should have the property location: "confirmation"

TC2:

  1. Go to the test dapp
  2. Initiate the signature 'SIGN IN WITH EHTEREUM (BAD DOMAIN)
  3. Click on confirm
  4. Reject it from the alert
  5. Look for the Signature Rejected event in the network tab, the request should have the property location: "alert_friction_modal"

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

@pnarayanaswamy pnarayanaswamy requested review from a team as code owners August 16, 2024 13:26
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.

@pnarayanaswamy pnarayanaswamy added the team-confirmations Push issues to confirmations team label Aug 16, 2024
Copy link

socket-security bot commented Aug 19, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] None 0 252 kB metamaskbot

🚮 Removed packages: npm/@metamask/[email protected]), npm/@metamask/[email protected]), npm/@metamask/[email protected]), npm/@metamask/[email protected]), npm/[email protected]), npm/[email protected])

View full report↗︎

Copy link

socket-security bot commented Aug 19, 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/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

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/[email protected] or ignore all packages with @SocketSecurity ignore-all

@pnarayanaswamy
Copy link
Contributor Author

@SocketSecurity ignore-all

@@ -820,6 +820,8 @@ export enum MetaMetricsEventLocation {
TokenDetection = 'token_detection',
TokenMenu = 'token_menu',
Transaction = 'transaction',
Confirmation = 'confirmation',
AlertFrictionModal = 'alert_friction_modal',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but should we keep this enum in alphabetical order?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

await driver.clickElement('#siweBadDomain');
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);

const alert = await driver.findElement('[data-testid="inline-alert"]');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending the full page object model, could large parts of this go into reusable helpers such as expectAlert or acknowledgeAlert or confirmWithAlertModal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@metamaskbot
Copy link
Collaborator

Builds ready [443ca41]
Page Load Metrics (79 ± 9 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint661721072612
domContentLoaded41117732010
load4811779209
domInteractive96229136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 66.23 KiB (1.86%)
  • ui: 545 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.05%. Comparing base (c3069ee) to head (7bb6852).

Files Patch % Lines
...confirmations/components/confirm/footer/footer.tsx 88.89% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #26469   +/-   ##
========================================
  Coverage    70.05%   70.05%           
========================================
  Files         1414     1414           
  Lines        49317    49325    +8     
  Branches     13780    13780           
========================================
+ Hits         34546    34554    +8     
  Misses       14771    14771           

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

@metamaskbot
Copy link
Collaborator

Builds ready [2427b8c]
Page Load Metrics (84 ± 10 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint751741142411
domContentLoaded44121812110
load50132842110
domInteractive116230115
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 66.23 KiB (1.86%)
  • ui: 545 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [6d8e279]
Page Load Metrics (76 ± 10 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint671471032010
domContentLoaded41130712110
load47133762110
domInteractive96730157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 66.23 KiB (1.86%)
  • ui: 548 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [d2bf9fb]
Page Load Metrics (83 ± 12 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint772421123919
domContentLoaded57148792412
load57156832412
domInteractive196632136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 66.23 KiB (1.83%)
  • ui: 548 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [cbcfc11]
Page Load Metrics (73 ± 6 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6913096168
domContentLoaded429968147
load499973136
domInteractive9532894
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 66.23 KiB (1.83%)
  • ui: 548 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [cfee05f]
Page Load Metrics (77 ± 11 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint69141102199
domContentLoaded41124732411
load48124772211
domInteractive106230157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 66.23 KiB (1.83%)
  • ui: 548 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

matthewwalsh0
matthewwalsh0 previously approved these changes Aug 27, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [0c30dc2]
Page Load Metrics (86 ± 7 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint841701192311
domContentLoaded4811683178
load5811686157
domInteractive96734136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 33.3 KiB (0.96%)
  • ui: 548 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

Copy link

@pnarayanaswamy pnarayanaswamy merged commit 99d2c86 into develop Aug 28, 2024
77 of 78 checks passed
@pnarayanaswamy pnarayanaswamy deleted the signature-alert-metrics branch August 28, 2024 14:49
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2024
@metamaskbot metamaskbot added the release-12.5.0 Issue or pull request that will be included in release 12.5.0 label Aug 28, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [7bb6852]
Page Load Metrics (87 ± 13 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint822151203316
domContentLoaded46169842914
load53170872813
domInteractive117530178
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 33.3 KiB (0.96%)
  • ui: 548 Bytes (0.01%)
  • common: 74 Bytes (0.00%)

@gauthierpetetin gauthierpetetin added release-12.4.0 Issue or pull request that will be included in release 12.4.0 and removed release-12.5.0 Issue or pull request that will be included in release 12.5.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.4.0 Issue or pull request that will be included in release 12.4.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants