Commit b0c13ff1 authored by Mustafa Emre Acer's avatar Mustafa Emre Acer Committed by Commit Bot

[SB Delayed Warnings] Do not check for CSD if there is a delayed warning

When Delayed Warnings feature detects and delays an interstitial, Client
Side Detection could send another phishy verdict for the same URL. This
causes the interstitial to be undelayed immediately. This CL changes the
CSD behavior so that it never checks if a Delayed Warning observer is
attached to a tab which only happens if a warning is being delayed.

This is manually tested to work both on official and non-official
builds. A follow up CL will add browser tests.

Bug: 1118192
Test: Manual
Change-Id: I418910c35ec692ef23e4295a6b59092cb55d5968
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2364213Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799881}
parent f37639af
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "chrome/browser/safe_browsing/client_side_detection_service.h" #include "chrome/browser/safe_browsing/client_side_detection_service.h"
#include "chrome/browser/safe_browsing/client_side_detection_service_factory.h" #include "chrome/browser/safe_browsing/client_side_detection_service_factory.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/user_interaction_observer.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/safe_browsing/content/common/safe_browsing.mojom-shared.h" #include "components/safe_browsing/content/common/safe_browsing.mojom-shared.h"
...@@ -126,6 +127,12 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest ...@@ -126,6 +127,12 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest
DontClassifyForPhishing(NO_CLASSIFY_WHITELISTED_BY_POLICY); DontClassifyForPhishing(NO_CLASSIFY_WHITELISTED_BY_POLICY);
} }
// If the tab has a delayed warning, ignore this second verdict. We don't
// want to immediately undelay a page that's already blocked as phishy.
if (SafeBrowsingUserInteractionObserver::FromWebContents(web_contents_)) {
DontClassifyForPhishing(NO_CLASSIFY_HAS_DELAYED_WARNING);
}
// We lookup the csd-whitelist before we lookup the cache because // We lookup the csd-whitelist before we lookup the cache because
// a URL may have recently been whitelisted. If the URL matches // a URL may have recently been whitelisted. If the URL matches
// the csd-whitelist we won't start phishing classification. The // the csd-whitelist we won't start phishing classification. The
...@@ -169,6 +176,7 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest ...@@ -169,6 +176,7 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest
NO_CLASSIFY_SCHEME_NOT_SUPPORTED = 11, NO_CLASSIFY_SCHEME_NOT_SUPPORTED = 11,
NO_CLASSIFY_WHITELISTED_BY_POLICY = 12, NO_CLASSIFY_WHITELISTED_BY_POLICY = 12,
CLASSIFY = 13, CLASSIFY = 13,
NO_CLASSIFY_HAS_DELAYED_WARNING = 14,
NO_CLASSIFY_MAX // Always add new values before this one. NO_CLASSIFY_MAX // Always add new values before this one.
}; };
......
...@@ -62323,6 +62323,7 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf ...@@ -62323,6 +62323,7 @@ https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf
<int value="11" label="SCHEME_NOT_SUPPORTED"/> <int value="11" label="SCHEME_NOT_SUPPORTED"/>
<int value="12" label="WHITELISTED_BY_POLICY"/> <int value="12" label="WHITELISTED_BY_POLICY"/>
<int value="13" label="CLASSIFY"/> <int value="13" label="CLASSIFY"/>
<int value="14" label="NO_CLASSIFY_HAS_DELAYED_WARNING"/>
</enum> </enum>
<enum name="SBClientDownloadCheckDownloadStats"> <enum name="SBClientDownloadCheckDownloadStats">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment