-
Notifications
You must be signed in to change notification settings - Fork 932
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 feed to isMalicious return type and update error page with feed info #5564
base: develop
Are you sure you want to change the base?
Add feed to isMalicious return type and update error page with feed info #5564
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
b6d3050
to
31ef2ac
Compare
37a2b10
to
d297727
Compare
d297727
to
31c9560
Compare
3948aaa
to
a2affdd
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
just few comments, nothin blocking.
Test cases worked fine. I've found an issue but unsure if related to changes here, so will share directly in Asana to triage.
PHISHING -> MaliciousSiteStatus.PHISHING | ||
} | ||
if (!exempted) { | ||
loadingViewState.postValue(currentLoadingViewState().copy(isLoading = false, url = url.toString())) |
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've noticed we dropped progress = 100
in the diff. Intended?
url: Uri?, | ||
) { | ||
if (isMalicious is Malicious) { | ||
handleSiteBlocked(webViewClientListener, url, isMalicious.feed, false) |
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.
So, if I get this right, we have false
here as exempted because this is the async callback. And we should assume the synchronous logic already checks if it's exempted, so any exempted url will never land in the async callback. Can we leave a comment about that in this line?
The second question, it's to validate why we need to pass it down. I assume if a site is exempted, we don't block, but we want to update the omnibar logo, right?
filterSet.filters.firstOrNull { | ||
Pattern.compile(it.regex).matcher(url.toString()).find() | ||
}?.let { | ||
Timber.d("\uD83D\uDFE2 Cris: shouldBlock $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.
NIT: do we have a Tag/Prefix you want to use from now on for logs? Probably better to start using it now, in case we forget to clean the logs with Cris.
Maybe just use MaliciousSiteDetector
or MaliciousSite`?
val result = matches(hashPrefix, url, hostname, hash)?.let { feed: Feed -> | ||
Malicious(feed) | ||
} ?: Safe | ||
confirmationCallback(result) | ||
} catch (e: Exception) { | ||
Timber.e(e, "\uD83D\uDD34 Cris: shouldBlock $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.
ditto
@@ -78,6 +78,7 @@ data class MatchResponse( | |||
val url: String, | |||
val regex: String, | |||
val hash: String, | |||
val category: String, |
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 do we call them Feed
but category
here? which one is how we refer to these in the objective?
@@ -197,9 +242,12 @@ class RealMaliciousSiteBlockerWebViewIntegration @Inject constructor( | |||
processedUrls.clear() | |||
} | |||
|
|||
override fun onSiteExempted(url: Uri) { | |||
override fun onSiteExempted( |
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.
Can we add some test to this method? it seems they are missing. I was wondering about for example: what if url is not a valid URI?
val convertedUrl = URLDecoder.decode(url.toString(), "UTF-8").lowercase() | ||
exemptedUrlsHolder.exemptedMaliciousUrls.add(convertedUrl) | ||
exemptedUrlsHolder.exemptedMaliciousUrls.add(ExemptedUrl(convertedUrl.toUri(), 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.
why receiving an url: Uri -> decoding to Url -> and converting to Uri again?
@SingleInstanceIn(AppScope::class) | ||
class ExemptedUrlsHolder @Inject constructor() { | ||
val exemptedMaliciousUrls = mutableSetOf<String>() | ||
val exemptedMaliciousUrls = mutableSetOf<ExemptedUrl>() |
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.
When checking how we use this, I don't see we ever check feed, only url. Do we have plans to differentiate exemptedUrls per feed?
Task/Issue URL: https://app.asana.com/0/1205008441501016/1209270355529418/f
Description
Add feed to isMalicious return type and update error page with feed info
Steps to test this PR
Feature 1
Feature 2
UI changes