New issue
Advanced search Search tips

Issue 666172 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug
Team-Security-UX



Sign in to add a comment

Security indicator disappears if you reload safebrowsing interstitial.

Project Member Reported by mattm@chromium.org, Nov 17 2016

Issue description

Chrome Version       : 56.0.2914.3 (Official Build) dev (64-bit)
OS Version: Ubuntu

What steps will reproduce the problem?
1. Visit http://testsafebrowsing.appspot.com/, click the first phishing link.
2. Note omnibox shows "Dangerous".
3. Hit reload.


What is the expected result?
Omnibox still shows Dangerous.


What happens instead of that?
Shows default "circle-i" icon.


Note that I have a pending CL (https://codereview.chromium.org/2510003002) that changes the SafeBrowsingBlockingPage reload handling a bit for  issue 655794 , so you might want to wait until after that to look at it. See also the TODO in safe_browsing_blocking_page_test.cc in that CL, where you can enable a test for this issue.

From browsing the code, it appears that when you reload, you get an InsertPending on the WhitelistUrlSet when the new interstitial is about to be created, and then a RemovePending when the previous interstitial is hidden to show the new one. So there were 2 inserts and 1 remove but the ordering is "wrong".
 
Looks like this is caused because the code relies on the new interstitial being shown in order to get rid of the old one (i.e. there is no explicit call to destroy the old one).

Adding a manual call to DontProceed() on the old one gets rid of the bug, but causes the previous page to be flashed on the screen before the interstitial comes up again, seems that manually calling OnDontProceed() (without running the rest of the code that's in DontProceed()) would solve the problem.

This bug also doesn't seem to be specific to reloads, it also shows if you navigate from a safe browsing interstitial to another website that would show one. For example if you are seeing the interstitial for http://testsafebrowsing.appspot.com/s/phishing.html and try to go to http://testsafebrowsing.appspot.com/s/malware.html the icon on the second interstitial will be the gray i.
A bit more on the root cause of this, it seems to be happening because the add to the WhitelistUrlSet gets called from DisplayBlockingPage, which gets called from the url_checker, meanwhile the call to remove from the whitelist happens in OnBlockingPageDone, which gets called from OnDontProceed, which in the case of a reload, or a move from interstitial to interstitial happens in the Show method of the new interstitial. Since the url_checker runs before the call to show(), that causes the wrong order between add/remove to whitelist.

Possible solutions (that don't modify calls for other types of interstitials):
1) Change where the calls to add/remove from whitelist happen.
2) Manually call onDontProceed in the specific case where the page is currently a safe browsing interstitial and a new one is being loaded.
3) Special case the remove from whitelist call, so it doesn't run if the new site is also triggering a safe browsing interstitial (Simplest solution, but sounds hacky)

Comment 3 by est...@chromium.org, Sep 15 2017

Tricky! Thanks for looking into this. Here's another idea which I haven't fully thought through yet but might work: I wonder if what we really want to do is associate pending URLs with the blocking page that added them to the pending whitelist URL set.

So the |pending_| map in WhitelistUrlSet would actually be a map from a URL to a list of <BaseBlockingPage*, SBThreatType> pairs. InsertPending and RemovePending would take a BaseBlockingPage* as arguments and would insert/remove from the list instead of removing the URL entirely.

That way, when we hide a blocking page due to a refresh or a navigation to another interstitial, we would remove the pending URL corresponding to that particular blocking page, leaving intact the pending URL that the new interstitial added.

Do you think that would work?
Cc: est...@chromium.org
Owner: carlosil@chromium.org
Started working on that fix (keeping a pointer to the BaseBlockingPage), however in most cases where add/remove is called we don't have an instance of the BaseBlockingPage, so it would require some larger changes to the code in order to save a pointer to the blocking page object (and I couldn't figure out how to do it for ChromePasswordProtectionService, since it doesn't seem it uses a blocking page). 

What I thought was to keep a counter of how many times a website has been added (i.e. the map is now from url to pair<SBThreatType, int>), and when removing, the count gets reduced by one, and if it gets to 0 the site is removed from the map. The SBThreatType just gets updated to the last added on every add, since that would be the valid one (since everytime the count reaches 2, we know the older threat type is now stale).

Does this make sense? I am running the tests in trybot now, and plan to send it for review if it passes.
Status: Started (was: Assigned)
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d54f696d8df0053e47442be48219fa4ebb77e5d7

commit d54f696d8df0053e47442be48219fa4ebb77e5d7
Author: Carlos IL <carlosil@chromium.org>
Date: Thu Sep 21 02:40:51 2017

WhitelistURLSet now uses count for adding/removing

WhitelistURLSet keeps a count of how many times a URL has been added to
the pending whitelist, and when removing, it decreases the count by one
, onlyremoving a URL if the count reaches zero. This solves a problem
where upon reloading a safe browsing interstitial, the website would be
re-added and removed from the whitelist in the wrong order, causing it
to not be in the whitelist when it was supposed to.

Bug:  666172 
Change-Id: Ic870153381685890b5c3bc99ad2133837ffe34d7
Reviewed-on: https://chromium-review.googlesource.com/671672
Commit-Queue: Carlos IL <carlosil@chromium.org>
Reviewed-by: Jialiu Lin <jialiul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#503335}
[modify] https://crrev.com/d54f696d8df0053e47442be48219fa4ebb77e5d7/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
[modify] https://crrev.com/d54f696d8df0053e47442be48219fa4ebb77e5d7/components/safe_browsing/base_ui_manager.cc

Status: Fixed (was: Started)

Sign in to add a comment