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 domain binding SIWE redesign alert row #25281

Merged
merged 55 commits into from
Jun 27, 2024

Conversation

digiwand
Copy link
Contributor

@digiwand digiwand commented Jun 13, 2024

Description

  • Adds Alert for Domain Binding SIWE
  • Minor out-of-scope cleanup:
    • update useBlockaidAlert to use currentConfirmationSelector instead of useCurrentConfirmation c21feb2
    • force return boolean for isSIWESignatureRequest f779176

Currently, the existing logic displays the same friction modal for multiple alerts with only one danger alert. There will be a separate PR to update the Alert System to follow the designs mentioned in the Issue ticket

Related issues

Fixes: #24683

Manual testing steps

  1. comment out code in useCurrentConfirmation:
// // comment if condition below to enable re-design for SIWE signatures
  1. yarn start
  2. open dapp and test SIWE Bad Domain

Screenshots/Recordings

Before

After

(There is another PR that is hiding the "i" icon beside the Alert for SIWE)


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.

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

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.70%. Comparing base (d403213) to head (52502c2).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25281      +/-   ##
===========================================
+ Coverage    69.69%   69.70%   +0.01%     
===========================================
  Files         1350     1351       +1     
  Lines        47865    47881      +16     
  Branches     13199    13203       +4     
===========================================
+ Hits         33355    33371      +16     
  Misses       14510    14510              

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

@digiwand digiwand added the team-confirmations Push issues to confirmations team label Jun 14, 2024
@digiwand digiwand marked this pull request as ready for review June 19, 2024 13:08
@digiwand digiwand requested review from a team as code owners June 19, 2024 13:08
@metamaskbot
Copy link
Collaborator

Builds ready [780f5b7]
Page Load Metrics (47 ± 6 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6511281105
domContentLoaded9131010
load409747126
domInteractive9131010
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.82 KiB (0.03%)
  • common: 245 Bytes (0.00%)

jpuri
jpuri previously approved these changes Jun 24, 2024
Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

👍

matthewwalsh0
matthewwalsh0 previously approved these changes Jun 25, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [e817fec]
Page Load Metrics (43 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint5611275115
domContentLoaded8111010
load37574363
domInteractive8111010
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.82 KiB (0.03%)
  • common: 245 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [e817fec]
Page Load Metrics (43 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint5611275115
domContentLoaded8111010
load37574363
domInteractive8111010
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.82 KiB (0.03%)
  • common: 245 Bytes (0.00%)

@digiwand
Copy link
Contributor Author

hello again and apologies, may I get a re-review please? @jpuri @matthewwalsh0

merge conflict undid approvals. I took this as an opportunity to update the filepaths from useDomainMismatchAlert → useDomainMismatchAlerts to match pattern of similar hooks

@metamaskbot
Copy link
Collaborator

Builds ready [52502c2]
Page Load Metrics (136 ± 171 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint69158872110
domContentLoaded95214105
load421689136356171
domInteractive95214105
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.82 KiB (0.03%)
  • common: 245 Bytes (0.00%)

@@ -44,7 +44,7 @@ const SIWESignInfo: React.FC = () => {
return (
<>
<ConfirmInfoRow label={t('message')}>
<ConfirmInfoRowText text={statement} />
<ConfirmInfoRowText text={statement || ''} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<ConfirmInfoRowText text={statement || ''} />
<ConfirmInfoRowText text={statement ?? ''} />

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh nice! I can update this in a subsequent alert PR to not need re-reviews


const isSIWE = isSIWESignatureRequest(currentConfirmation);
const isInvalidSIWEDomain =
isSIWE && !isValidSIWEOrigin(msgParams as WrappedSIWERequest);
Copy link
Contributor

Choose a reason for hiding this comment

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

It will be useful to include above 3 lines also inside useMemo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had this originally and then @matthewwalsh0 brought up a good point to reduce the # of observed dependencies

Copy link
Contributor

@jpuri jpuri left a comment

Choose a reason for hiding this comment

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

Changes look good 👍

@digiwand digiwand merged commit 66bf2f1 into develop Jun 27, 2024
70 checks passed
@digiwand digiwand deleted the feat-sign-refactor-alerts branch June 27, 2024 16:21
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redesign Signature SIWE: Add domain binding alert for deceptive signature
4 participants