AdGuardForSafari icon indicating copy to clipboard operation
AdGuardForSafari copied to clipboard

Include AdGuard URL Tracking filter

Open henryhchchc opened this issue 3 years ago • 5 comments

Prerequisites

  • [X] I checked to make sure that this issue has not already been filed;
  • [X] This is not an ad/bug report.

Problem description

I notice that the AdGuard URL Tracking filter is not included in the list of filters.

Proposed solution

I checked the rules and found most of them are removeparam rules. To my understanding it requires the redirect action on Safari side.

Apple added support for redirect 10 months ago as mentioned in https://webkit.org/blog/12193/release-notes-for-safari-technology-preview-139/

Added support for the redirect rule type in declarativeNetRequest, which requires host permissions to be granted for the host of the URL being redirected

I think this feature is available in Safari 16 but Apple haven't updated their documentation.

Additional information

No response

henryhchchc avatar Dec 03 '22 11:12 henryhchchc

Currently, adguard for safari uses content blockers for filtering (https://developer.apple.com/documentation/safariservices/creating_a_content_blocker)

In the release notes, they talk about web extensions. Maybe in the future adguard for safari would start using under-the-hood web extensions too.

maximtop avatar Jan 12 '23 11:01 maximtop

Thanks for the explanations. I thought AdGuard is using Web Extensions :)

henryhchchc avatar Jan 12 '23 11:01 henryhchchc

Well, on the other hand in the case of Safari declarativeNetRequest is built on Safari content blockers. Maybe it was added there as well?

ameshkov avatar Jan 12 '23 21:01 ameshkov

Here's the relevant changeset in Safari: https://trac.webkit.org/changeset?reponame=webkit&new=287040%40trunk&old=287039%40trunk

ameshkov avatar Jan 12 '23 21:01 ameshkov

Had a talk with a WebKit engineer.

  1. redirect rules are actually available via content blockers file: https://github.com/WebKit/WebKit/blob/cf203f4511ff5d596126af5057da721eb625901f/Source/WebCore/contentextensions/ContentExtensionActions.cpp#L311
  2. The problem is that they won't work as they require extension to be granted explicit permissions on the affected URLs. These permissions can only be granted to Web Extensions.

So currently we're in the following situation:

  1. dNR supports pretty much everything from CB except one very important thing - cosmetic rules.
  2. Therefore using just Web Extensions makes little sense, we have to stick to CB.
  3. We could bring redirect rules to AdGuard for iOS as it uses a Web Extension for advanced ad blocking functionality. We should also consider finally switching AdGuard for Safari to using a Web Extension instead of the legacy Safari extension.

ameshkov avatar Jan 13 '23 08:01 ameshkov