Skip to content

Add separate worker for scam, so it can handle RC updates immediately #5857

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 4, 2025

Task/Issue URL: https://app.asana.com/0/0/1209893469792815/f

Description

Steps to test this PR

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

Before After
!(Upload before screenshot) (Upload after screenshot)

Copy link
Contributor Author

CrisBarreiro commented Apr 4, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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 force-pushed the feature/cris/scam-protection/add-separate-worker-for-scam branch 3 times, most recently from 01ccafb to f8bc86b Compare April 4, 2025 11:04
@CrisBarreiro CrisBarreiro requested a review from cmonfortep April 4, 2025 11:08
@CrisBarreiro CrisBarreiro marked this pull request as ready for review April 4, 2025 11:08
@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-separate-worker-for-scam branch from f8bc86b to 9ed1aca 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
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-separate-worker-for-scam branch from 9ed1aca to c5faa7e 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.

LGTM just left some comments for readability


val feeds = inputData.getStringArray(TYPE)
?.mapNotNull { Feed.fromString(it) }
?.filter { it != 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 find it != SCAM || maliciousSiteProtectionFeature.scamProtectionEnabled() difficult to read / process, I understand you want to remove scam as feed unless they feature flag is enabled, but it took me some time. I feel it's not clear how the 2 checks are connected.

what about something as:

val feeds = inputData.getStringArray(TYPE)
                ?.mapNotNull { Feed.fromString(it) }
                ?.let { feeds ->
                    if (!maliciousSiteProtectionFeature.scamProtectionEnabled()) {
                        feeds.filterNot { it == SCAM }
                    }
                    feeds
                }


val feeds = inputData.getStringArray(TYPE)
?.mapNotNull { Feed.fromString(it) }
?.filter { it != 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.

ditto

return loadDataOfType(FILTER_SET) { latestRevision, networkRevision, feed -> loadFilters(latestRevision, networkRevision, feed) }
override suspend fun loadFilters(vararg feeds: Feed): Result<Unit> {
return loadDataOfType(FILTER_SET) {
latestRevision, networkRevision ->
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 localRevisions instead of latestRevision? Just to have consistency with localRevisions = getLocalRevisions(type)

return loadDataOfType(HASH_PREFIXES) { latestRevision, networkRevision, feed -> loadHashPrefixes(latestRevision, networkRevision, feed) }
override suspend fun loadHashPrefixes(vararg feeds: Feed): Result<Unit> {
return loadDataOfType(HASH_PREFIXES) {
latestRevision, networkRevision ->
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@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
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/scam-protection/add-separate-worker-for-scam branch from c5faa7e to 91ff0e9 Compare April 21, 2025 14:45
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 merged commit b89d6bf into feature/cris/scam-protection/add-support-for-scam-protection Apr 25, 2025
14 of 17 checks passed
@CrisBarreiro CrisBarreiro deleted the feature/cris/scam-protection/add-separate-worker-for-scam branch April 25, 2025 10:47
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.

2 participants