Bug 234439 - Fix Safari-side SafeBrowsing telemetry
Summary: Fix Safari-side SafeBrowsing telemetry
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-17 11:35 PST by Eliot Hsu
Modified: 2021-12-21 15:19 PST (History)
2 users (show)

See Also:


Attachments
Patch (3.36 KB, patch)
2021-12-17 11:55 PST, Eliot Hsu
no flags Details | Formatted Diff | Diff
Patch (3.34 KB, patch)
2021-12-20 13:41 PST, Eliot Hsu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eliot Hsu 2021-12-17 11:35:50 PST
Telemetry for Safari Safe Browsing was previously handled in Safari. Now that WebKit decides whether or not to show Safe Browsing warnings, and queries the Safe Browsing Service itself, we should pass along the (anonymized and privacy-preserving) telemetry to Safari to fix the metrics that were previously there.
Comment 1 Eliot Hsu 2021-12-17 11:55:48 PST
Created attachment 447466 [details]
Patch
Comment 2 Eliot Hsu 2021-12-20 13:41:42 PST
Created attachment 447631 [details]
Patch
Comment 3 Alex Christensen 2021-12-20 14:40:06 PST
Comment on attachment 447631 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=447631&action=review

> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:1801
>          if (navigatesFrame && forMainFrameNavigation) {
>              // The safe browsing warning will be hidden once the next page is shown.
> +            bool continuingUnsafeLoad = WTF::switchOn(result,
> +                [] (ContinueUnsafeLoad continueUnsafeLoad) { return continueUnsafeLoad == ContinueUnsafeLoad::Yes; },
> +                [] (const URL&) { return false; }
> +            );

If navigatesFrame is true, then we know that result is ContinueUnsafeLoad::Yes.  This check seems unnecessary.

> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:1806
> +            else
> +                dictionary.set("action"_s, String("redirect to url"));

And this seems unreachable.
Comment 4 Eliot Hsu 2021-12-20 15:04:19 PST
Comment on attachment 447631 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=447631&action=review

>> Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:1801
>> +            );
> 
> If navigatesFrame is true, then we know that result is ContinueUnsafeLoad::Yes.  This check seems unnecessary.

In the case where the Safe Browsing warning page shows, and the user clicks on the "Learn more..." or "report an error" links instead of "Visit this unsafe website", then `navigatesFrame` and `forMainFrameNavigation` are both true, but `continueUnsafeLoad` is `ContinueUnsafeLoad::No`.
Comment 5 Alex Christensen 2021-12-21 14:41:27 PST
Comment on attachment 447631 [details]
Patch

yep, I read it wrong the first time.
Comment 6 EWS 2021-12-21 15:18:09 PST
Committed r287333 (245479@main): <https://commits.webkit.org/245479@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447631 [details].
Comment 7 Radar WebKit Bug Importer 2021-12-21 15:19:29 PST
<rdar://problem/86786182>