Opened 4 years ago

Last modified 14 months ago

#1564 new change

Fix FilterEngine::Matches for allowing request which is whitelisted in the ascendant node

Reported by: sergz Assignee: sergz
Priority: Unknown Milestone:
Module: Libadblockplus Keywords:
Cc: fhd, oleksandr Blocked By: #1585
Blocking: Platform: Unknown
Ready: no Confidential: no
Tester: Verified working: no
Review URL(s):

Description

Background

Let's say we have page A which loads resource B which loads resource C, thus A->B->C and the filter @@||C$SOME_TYPE,domain=A, where SOME_TYPE is not document. When we load resource C, the referer is B. We should not block C if the type of request for C is SOME_TYPE.

Let's consider the real example, in the method FilterEngine::Matches(url, contentType, documentUrls) the parameters are

url = http://news.bbcimg.co.uk/shared/swf/bbccom/0.3.289/bbcdotcom/SmpAds.swf
contentType = OBJECT_SUBREQUEST
documentUrls[0] = http://www.bbc.com/news/world-europe-29105979
documentUrls[1] = http://emp.bbci.co.uk/emp/SMPf/1.9.45/StandardMediaPlayerChromelessFlash.swf

and filters

/SmpAds.
@@||bbcimg.co.uk^*/SmpAds.swf$object-subrequest,domain=bbc.com

BTW, in FF it's not blocked.

What to change

Take a look at FilterEngine::Matches. We need to check whether there is some whitelisting entry for <url, contentType> and any page in the referer chain, thus CheckFilterMatch(url, contentType, documentUrls[i]); and we need to check the whitelisting entry for all CheckFilterMatch(documentUrls[i], "DOCUMENT", documentUrls[j]); where i <= j. It's not strong, i < j, because we also can whitelist the everything from the root page, for example @@||example.org^$document, because document — the page itself.

Change History (5)

comment:1 Changed 4 years ago by sergz

  • Blocking 1565 added

comment:2 Changed 4 years ago by trev

The problem here isn't the matching - that one works correctly, both in Firefox and libadblockplus. It's rather that StandardMediaPlayerChromelessFlash.swf isn't a document - it's merely a Flash object inside a document. So the document URL for SmpAds.swf should still be world-europe-29105979. In other words, libadblockplus wants to get a frame structure - what it gets are referrers however, not quite the same thing...

comment:3 Changed 4 years ago by sergz

  • Blocked By 1585 added

comment:4 Changed 4 years ago by oleksandr

  • Blocking 1565 removed

comment:5 Changed 14 months ago by fhd

  • Cc trev removed
Note: See TracTickets for help on using tickets.