-
Notifications
You must be signed in to change notification settings - Fork 949
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
Add Malicious Site Protection algorithm pixels #5604
Add Malicious Site Protection algorithm pixels #5604
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
2592f74
to
39aa159
Compare
3d36dce
to
79c5789
Compare
7001024
to
97b9ac5
Compare
79c5789
to
40577d8
Compare
40577d8
to
3cff846
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, left a note in Asana about testing.
3910261
to
d3e8362
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Few comments, and I see also a bunch of logs that not sure if we want to keep, but we should use the right tag for consistency. (I've commented in some of them, but there are a more).
@@ -243,7 +270,7 @@ class RealMaliciousSiteBlockerWebViewIntegration @Inject constructor( | |||
} else { | |||
Safe | |||
} | |||
processedUrls.clear() | |||
processedUrls[url] = isMalicious |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a previous check if (checkId == currentCheckId.get())
that validates this is related to the latest site trying to load. If we detect another site has started loading, we return safe to avoid showing the phishing page in the wrong context. However, we are assigning Safe to possible phishing pages here. I believe the right value here is processedUrls[url] = it
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes a lot of sense, thanks!
@@ -397,4 +397,6 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName { | |||
SET_AS_DEFAULT_PROMPT_CLICK("m_set-as-default_prompt_click"), | |||
SET_AS_DEFAULT_PROMPT_DISMISSED("m_set-as-default_prompt_dismissed"), | |||
SET_AS_DEFAULT_IN_MENU_CLICK("m_set-as-default_in-menu_click"), | |||
|
|||
MALICIOUS_SITE_DETECTED_IN_IFRAME("m_malicious-site-protection_iframe-loaded"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this one here if we have MaliciousSitePixelName
? this should be inside malicious module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because MaliciousSitePixelName
belongs to the MSP implementation module, and the MSP module knows nothing about iframes, that happens on the browser level
Match(it.hostname, it.url, it.regex, it.hash, feed) | ||
} else { | ||
null | ||
withTimeout(1000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found why 1000 is the timeout here in the pixel definition, or in Asana. Do we have it somewhere? would be good to move it into a const, and leave a comment or link with context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmonfortep, I believe this was discussed on a meeting. We recently created a task to document timeouts and it looks like all other platforms are using a different value, so I'll probably need to update this one. We also want to update the timeout for dataset downloads, and I've created a task for it, so for now I'm just extracting it to a constant. I've asked whether we want to update this timeout in particular to 5s, so in case the answer is yes, I'll use the task for dataset downloads timeout to also update this one
if (!exempted) { | ||
if (currentBrowserViewState().maliciousSiteDetected && previousSite?.url == url.toString()) return | ||
Timber.tag("Cris").d("Received MaliciousSiteWarning for $url, feed: $feed, exempted: false, clientSideHit: $clientSideHit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to keep this log, we should use a the right tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the tag, since we don't seem to be setting any specific one for this class
@@ -137,6 +140,9 @@ class RealMaliciousSiteBlockerWebViewIntegration @Inject constructor( | |||
if (!isEnabled()) { | |||
return IsMaliciousViewData.Safe | |||
} | |||
|
|||
Timber.d("shouldIntercept ${request.url}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
val exemptedUrl = exemptedUrlsHolder.exemptedMaliciousUrls.firstOrNull { it.url.toString() == decodedUrl } | ||
|
||
if (exemptedUrl != null) { | ||
Timber.tag("MaliciousSiteDetector").d("Previously exempted, skipping $decodedUrl as ${exemptedUrl.feed}") | ||
Timber.d("Previously exempted, skipping $decodedUrl as ${exemptedUrl.feed}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see we've removed tag, not sure if intentional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, similar to #5604 (comment), we don't use tag for other logs in this class
d3e8362
to
991e53b
Compare
Task/Issue URL: https://app.asana.com/0/488551667048375/1209304069660515
Description
Steps to test this PR
Feature 1
Feature 2
Feature 3
UI changes