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

Open sea security provider warning message #17662

Merged
merged 9 commits into from
Feb 23, 2023

Conversation

filipsekulic
Copy link
Contributor

@filipsekulic filipsekulic commented Feb 8, 2023

Explanation

Manual Testing Steps

  1. Go to test-dapp
  2. Select one of the options:
  • SEND LEGACY TRANSACTION
  • SEND EIP 1559 TRANSACTION
  • ETH SIGN
  • PERSONAL SIGN
  • SIGN TYPED DATA
  • SIGN TYPED DATA V3
  • SIGN TYPED DATA V4
  • SIGN IN WITH ETHEREUM
  • SIGN IN WITH ETHEREUM (W/ RESOURCES)
  • SIGN IN WITH ETHEREUM (BAD ACCOUNT)
  • SIGN IN WITH ETHEREUM (MALFORMED)

The warning message will appear depending on the input data sent to the OpenSea security provider.

@filipsekulic filipsekulic self-assigned this Feb 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2023

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.

@dzfjz
Copy link
Contributor

dzfjz commented Feb 9, 2023

Verified by QA

@filipsekulic filipsekulic marked this pull request as ready for review February 9, 2023 12:52
@filipsekulic filipsekulic requested a review from a team as a code owner February 9, 2023 12:52
@filipsekulic filipsekulic requested a review from danjm February 9, 2023 12:52
<SecurityProviderBannerMessage
securityProviderResponse={txData?.securityProviderResponse}
/>
)}
<ConfirmPageContainerSummary
className={classnames({
'confirm-page-container-summary--border':
Copy link
Contributor

Choose a reason for hiding this comment

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

Will be nice to have test coverage of the code change in this component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed here: 40ce40f

@jpuri
Copy link
Contributor

jpuri commented Feb 9, 2023

Code changes look good to me, will be nice to have some test more coverage.

@filipsekulic filipsekulic force-pushed the open-sea-security-provider-warning-message branch from 0478bca to 40ce40f Compare February 10, 2023 15:47
@filipsekulic filipsekulic requested a review from jpuri February 10, 2023 15:48
@filipsekulic filipsekulic force-pushed the open-sea-security-provider-warning-message branch from 40ce40f to 186dd8b Compare February 13, 2023 08:55
@metamaskbot
Copy link
Collaborator

Builds ready [186dd8b]
Page Load Metrics (1450 ± 108 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint922141342914
domContentLoaded108719441416214103
load108719451450224108
domInteractive108719441416214103
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 211 bytes
  • ui: 4104 bytes
  • common: 0 bytes

<SecurityProviderBannerMessage
securityProviderResponse={txData?.securityProviderResponse}
/>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

From changes in snaps I am in doubt error message is showing up by default.

This will be true txData?.securityProviderResponse?.flagAsDangerous !== 0 even if txData?.securityProviderResponse?.flagAsDangerous is undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, good catch! The securityProviderResponse was added into beforeEach and it affected all the tests including the ones that check matching the snapshot. It is fixed now and you can check the changes.

Copy link
Contributor

@segun segun left a comment

Choose a reason for hiding this comment

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

few comments about constants


it('should render SecurityProviderBannerMessage component properly when flagAsDangerous is 1', () => {
const securityProviderResponse = {
flagAsDangerous: 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use named constants here, 0, 1, 2 doesn't mean much and could be confusing maintaining this in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


it('should not render SecurityProviderBannerMessage component when flagAsDangerous is 0', () => {
props.txData.securityProviderResponse = {
flagAsDangerous: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above...we should use named constant here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@filipsekulic filipsekulic force-pushed the open-sea-security-provider-warning-message branch from 02c2f7d to 7d86790 Compare February 17, 2023 13:59
@metamaskbot
Copy link
Collaborator

Builds ready [c72bed0]
Page Load Metrics (1598 ± 39 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint96165127189
domContentLoaded1426171715737134
load1426181215988239
domInteractive1426171715737134
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 211 bytes
  • ui: 6152 bytes
  • common: 0 bytes

jpuri
jpuri previously approved these changes Feb 20, 2023
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.

LGTM

@filipsekulic filipsekulic requested a review from segun February 20, 2023 14:22
@seaona
Copy link
Contributor

seaona commented Feb 20, 2023

I've QAd the PR and overall looks good. I have some open questions which are not blockers but always good to clarify:

  1. On SIWE signatures, we are sending the validate request but we don't display the Warning/Dangerous message. Is this expected?
siwe-warning2.mp4
  1. When we receive a 500 response, (for example, if their server is down) the functionality simply stops working and we do not display any Warning/Malicious message. Is this expected?
opensea-500-response.mp4
  1. If we receive a flagAsDangerous value different than 0, 1 or 2, we display the fallback Request not verified. Is this expected?

image

opensea-5.mp4
  1. In the case we receive a response with flagAsDangerousvalue of 1, but with reason or reason_header empty, is it okay to display the empty banner?
opensea-empty-header-reason.mp4

cc @bschorchit

@bschorchit
Copy link

Thank you for your amazing 👀 here @seaona ! ❤️

  1. @filipsekulic could we also display the warning for the SIWE signature requests? This is a new signature request that's being introduced in the next release (10.26). Thanks!

  2. We should display the request not verified warning (screenshot below) if we receive a 500 response from the API. @filipsekulic could you update this?

Screenshot 2023-02-20 at 13 04 24

  1. Yes, this is the intended fallback warning for any error case which should also include if the answer different than 0, 1 and 2.

  2. Oh nice catch! We didn't anticipated that. We should have a fallback copy for these case. @filipsekulic could you include the below fallback copy for when the request is flagged as malicious and either the reason_title or the reason parameter is empty? Thank you!
    Fallback copy reason_title : Request flagged as malicious
    Fallback copy for reason : The security provider has not shared additional details.

@filipsekulic
Copy link
Contributor Author

Hey @bschorchit and @seaona!
I fixed the issues mentioned. Thank you both! 😊

Added.SIWE.mov
Status.code.500.mov
Missing.reason.or.reason.header.mov

@metamaskbot
Copy link
Collaborator

Builds ready [85db441]
Page Load Metrics (1660 ± 62 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint961881232010
domContentLoaded13641931161911857
load13641931166013062
domInteractive13641931161911857
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 211 bytes
  • ui: 7551 bytes
  • common: 0 bytes

@codecov-commenter
Copy link

Codecov Report

Merging #17662 (85db441) into develop (962a861) will increase coverage by 0.03%.
The diff coverage is 80.85%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff             @@
##           develop   #17662      +/-   ##
===========================================
+ Coverage    62.23%   62.26%   +0.03%     
===========================================
  Files          902      904       +2     
  Lines        35139    35188      +49     
  Branches      8889     8921      +32     
===========================================
+ Hits         21868    21909      +41     
- Misses       13271    13279       +8     
Impacted Files Coverage Δ
...page-container/confirm-page-container.component.js 63.64% <ø> (ø)
...p/signature-request-siwe/signature-request-siwe.js 2.17% <0.00%> (-0.33%) ⬇️
app/scripts/lib/security-provider-helpers.js 30.43% <50.00%> (+14.65%) ⬆️
...banner-message/security-provider-banner-message.js 90.00% <90.00%> (ø)
...ontent/confirm-page-container-content.component.js 80.77% <100.00%> (+2.51%) ⬆️
...sage/security-provider-banner-message.constants.js 100.00% <100.00%> (ø)
...t-original/signature-request-original.component.js 52.78% <100.00%> (+2.78%) ⬆️
...p/signature-request/signature-request.component.js 75.68% <100.00%> (+2.15%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [f25e7c0]
Page Load Metrics (1669 ± 90 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint97141118147
domContentLoaded13392084161315776
load13402194166918790
domInteractive13392084161315776
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 211 bytes
  • ui: 7551 bytes
  • common: 0 bytes

@seaona
Copy link
Contributor

seaona commented Feb 21, 2023

thank you for the clarifications @bschorchit . I see all the issues fixed! Great work @filipsekulic !!

Copy link
Contributor

@segun segun left a comment

Choose a reason for hiding this comment

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

LGTM

@bschorchit bschorchit merged commit 2acd51a into develop Feb 23, 2023
@bschorchit bschorchit deleted the open-sea-security-provider-warning-message branch February 23, 2023 11:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wallet Tx Security Provider: Warning Message
8 participants