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

fix: Phishing page metrics #28364

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Conversation

mindofmar
Copy link
Contributor

@mindofmar mindofmar commented Nov 7, 2024

Description

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/orgs/MetaMask/projects/103/views/1?pane=issue&itemId=86413189

Manual testing steps

See Issue attached in Related Issues.

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

github-actions bot commented Nov 7, 2024

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.

@metamaskbot metamaskbot added the team-product-safety Push issues to Product Safety team label Nov 7, 2024
@mindofmar
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 7, 2024
@mindofmar mindofmar changed the title Fix: Phishing page metrics fix: Phishing page metrics Nov 7, 2024
@mindofmar mindofmar marked this pull request as ready for review November 7, 2024 18:52
@mindofmar mindofmar requested a review from a team as a code owner November 7, 2024 18:52
@metamaskbot
Copy link
Collaborator

Builds ready [e634bfc]
Page Load Metrics (2184 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25526142103462222
domContentLoaded18912532215217684
load19502540218417785
domInteractive30110532010
backgroundConnect1076362110
firstReactRender563001455728
getState86023199
initialActions00000
loadScripts13571927160214168
setupStore65814147
uiStartup216128802466215103
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 90 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Comment on lines +297 to +299
const blockedUrl =
blockReason === 'c2DomainBlocklist' ? details.initiator : hostname;

Copy link
Contributor

Choose a reason for hiding this comment

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

So there's a couple of things here:

  1. We should try to avoid having inline strings spread out, as it will make it much harder to update the blockReason value in the future (we would need to update the controller, and then remember to search for the actual string value in the Extension codebase). Here we could use the type from the PhishingController (if it is not exported, we can export it).
  2. we already have an if block above where we set a specific blockReason. And here we are adding another if clause for the blockReason to set the blockedUrl. We should collapse into the pre-existing if block that sets the blockReason and set the blockUrl as well.

Suggestion, update the above if block as below:

      let blockReason;
      let blockedUrl = hostname;
      if (phishingTestResponse?.result && blockedRequestResponse.result) {
        blockReason = `${phishingTestResponse.type} and ${blockedRequestResponse.type}`;
      } else if (phishingTestResponse?.result) {
        blockReason = phishingTestResponse.type;
      } else {
        blockReason = blockedRequestResponse.type;
        blockedUrl = details.initiator;
      }

Let me know your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template team-product-safety Push issues to Product Safety team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants