Skip to content

Commit

Permalink
Clear processed URLs after a page is marked as malicious
Browse files Browse the repository at this point in the history
  • Loading branch information
CrisBarreiro committed Jan 24, 2025
1 parent 7baf134 commit 1c4cd9e
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ class RealMaliciousSiteBlockerWebViewIntegration @Inject constructor(
if (request.isForMainFrame || (isForIframe(request) && documentUri?.host == request.requestHeaders["Referer"]?.toUri()?.host)) {
if (checkMaliciousUrl(decodedUrl, confirmationCallback)) {
return WebResourceResponse(null, null, null)
} else {
processedUrls.add(decodedUrl)
}
processedUrls.add(decodedUrl)
}
return null
}
Expand All @@ -141,8 +142,9 @@ class RealMaliciousSiteBlockerWebViewIntegration @Inject constructor(
if (isForMainFrame) {
if (checkMaliciousUrl(decodedUrl, confirmationCallback)) {
return@runBlocking true
} else {
processedUrls.add(decodedUrl)
}
processedUrls.add(decodedUrl)
}
false
}
Expand All @@ -153,12 +155,14 @@ class RealMaliciousSiteBlockerWebViewIntegration @Inject constructor(
confirmationCallback: (isMalicious: Boolean) -> Unit,
): Boolean {
val checkId = currentCheckId.incrementAndGet()
return maliciousSiteProtection.isMalicious(url.toUri()) { isMalicious ->
if (checkId == currentCheckId.get()) {
confirmationCallback(isMalicious)
return maliciousSiteProtection.isMalicious(url.toUri()) {
val isMalicious = if (checkId == currentCheckId.get()) {
it
} else {
confirmationCallback(false)
false
}
processedUrls.clear()
confirmationCallback(isMalicious)
} == MALICIOUS
}

Expand Down

0 comments on commit 1c4cd9e

Please sign in to comment.