Skip to content

Add support for scam protection #5853

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

Conversation

CrisBarreiro
Copy link
Contributor

@CrisBarreiro CrisBarreiro commented Apr 3, 2025

Task/Issue URL: https://app.asana.com/0/0/1209879813659870

Description

Steps to test this PR

Feature 1

Feature 2

From #5857

Feature 1

Feature 2

  • Without reinstalling the app, enable scamProtection under Feature Flag Inventory and restart the app
  • Using the app inspector, check that phishing, malware and scam datasets are present. Data needs to be downloaded, so it might take a few seconds to complete. The easiest way is to check the revisions table in malicious_sites db
  • Open https://privacy-test-pages.site/security/badware/scam.html and check it's blocked.
  • Disable scamProtection under Feature Flag Inventory and restart the app
  • Open https://privacy-test-pages.site/security/badware/scam.html and check it's not blocked

UI changes

image


Copy link
Contributor Author

CrisBarreiro commented Apr 3, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-support-for-scam-protection branch from d18103b to 68dccd5 Compare April 4, 2025 10:14
@CrisBarreiro CrisBarreiro requested a review from cmonfortep April 4, 2025 11:09
@CrisBarreiro CrisBarreiro marked this pull request as ready for review April 4, 2025 11:15
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-support-for-scam-protection branch from 68dccd5 to 4e93bfa Compare April 7, 2025 09:04
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-support-for-scam-protection branch from 7af243e to f160884 Compare April 10, 2025 13:51
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

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

Just few NITs.

We need to rebase develop to get the changes introduced with the ANR fix. After that I will re-review and test this.

@@ -153,7 +167,11 @@ class RealMaliciousSiteRepository @Inject constructor(
) {
val revision = latestRevision.getRevisionForFeed(feed)
val data: T? = if (networkRevision > revision) {
getFunction(revision)
if (feed == SCAM && !maliciousSiteProtectionFeature.scamProtectionEnabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't feel this generic method is the right place to put the feature flag check. Can we do it earlier?

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 moved it to a different place, but it's not super relevant, as #5857 deals with this in a different way

@@ -103,13 +109,17 @@ class RealMaliciousSiteProtection @Inject constructor(
(hostname == match.hostname) &&
(hash == match.hash)
}?.feed?.let { feed: Feed ->
Malicious(feed)
if (feed != SCAM || maliciousSiteProtectionRCFeature.scamProtectionEnabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I think it will be more readable (and easy to expand) if we move it as separate early checks

For example:

if (feed == SCAM && !maliciousSiteProtectionRCFeature.scamProtectionEnabled()) return@let Ignored

return@let Malicious(feed)

@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-support-for-scam-protection branch from f160884 to 4a0805e Compare April 21, 2025 13:53
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-support-for-scam-protection branch from b89d6bf to 346d097 Compare April 25, 2025 10:58
@CrisBarreiro CrisBarreiro merged commit 2e7d7a3 into develop Apr 30, 2025
13 checks passed
@CrisBarreiro CrisBarreiro deleted the feature/cris/scam-protection/add-support-for-scam-protection branch April 30, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants