From 53fbbee85c56a6fee15c7d163f22a346c45e7b8d Mon Sep 17 00:00:00 2001 From: Andrey Yakushin Date: Fri, 21 Jun 2024 15:58:50 +0400 Subject: [PATCH 1/8] Introduce strict-first-party and strict-third-party modifiers --- .../ad-filtering/create-own-filters.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index de39d8a226e..bc21ce5790f 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -279,6 +279,8 @@ Basically, they just limit the scope of rule application. | [$match-case](#match-case-modifier) | ✅ | ✅ | ✅ | ⏳ | ⏳ | ✅ | | [$method](#method-modifier) | ⏳ | ✅ | ✅ | ❌ | ❌ | ❌ | | [$popup](#popup-modifier) | ✅ * | ✅ | ✅ | ✅ * | ✅ * | ❌ | +| [$strict-first-party](#strict-first-party-modifier) | ⏳ | ❌ | ❌ | ❌ | ❌ | ❌ | +| [$strict-third-party](#strict-third-party-modifier) | ⏳ | ❌ | ❌ | ❌ | ❌ | ❌ | | [$third-party](#third-party-modifier) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | [$to](#to-modifier) | ⏳ | ✅ | ✅ | ❌ | ❌ | ❌ | @@ -578,6 +580,34 @@ AdGuard will try to close the browser tab with any address that matches a blocki ::: +#### **`$strict-first-party`** {#strict-first-party-modifier} + +Works the same as the [`$~third-party`](#third-party-modifier) modifier but treats the request as first-party only if the refferer and the origin share exactly the same hostname. + +**Examples** + +- `||domain.com$strict-first-party` — this rule is applied exclusively to `domain.com`. For example a request from `domain.com` to `http://domain.com/icon.ico` is a first-party request. Request from `sub.domain.com` to `http://domain.com/icon.ico` is treated as a third-party (unlike the `$~third-party` modifier). + +:::note + +You may use a shorter name (alias) instead of using the full modifier name: `$strict1p`. + +::: + +#### **`$strict-third-party`** {#strict-third-party-modifier} + +Works the same as the [`$third-party`](#third-party-modifier) modifier but also treats requests from the domain to its subdomains and vice versa as third-party requests. + +**Examples** + +- `||domain.com^$strict-third-party` — this rule applies to all domains, except `domain.com`. An example of a third-party request: `http://sub.domain.com/banner.jpg` (unlike the `$third-party` modifier). + +:::note + +You may use a shorter name (alias) instead of using the full modifier name: `$strict3p`. + +::: + #### **`$third-party`** {#third-party-modifier} A restriction of third-party and own requests. A third-party request is a request from a different domain. For example, a request to `example.org` from `domain.com` is a third-party request. @@ -2586,6 +2616,8 @@ Modifier aliases (`1p`, `3p`, etc.) are not included in these categories, howeve - [`$domain`](#domain-modifier) with negated domains using `~`, - [`$match-case`](#match-case-modifier), - [`$method`](#method-modifier) with negated methods using `~`, +- [`$strict-first-party`](#strict-first-party-modifier), +- [`$strict-third-party`](#strict-third-party-modifier), - [`$third-party`](#third-party-modifier), - [`$to`](#to-modifier), - restricted [content-types](#content-type-modifiers) with `~`. From d8fadd372acfe934ec693f5b29edb2b5cf41119e Mon Sep 17 00:00:00 2001 From: anyakushin <164042313+anyakushin@users.noreply.github.com> Date: Tue, 25 Jun 2024 18:07:49 +0400 Subject: [PATCH 2/8] Apply suggestions Co-authored-by: Helen <58733007+el-termikael@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index bc21ce5790f..4bc99ee5d14 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -582,15 +582,15 @@ AdGuard will try to close the browser tab with any address that matches a blocki #### **`$strict-first-party`** {#strict-first-party-modifier} -Works the same as the [`$~third-party`](#third-party-modifier) modifier but treats the request as first-party only if the refferer and the origin share exactly the same hostname. +Works the same as the [`$~third-party`](#third-party-modifier) modifier, but only treats the request as first-party if the referrer and origin have exactly the same hostname. **Examples** -- `||domain.com$strict-first-party` — this rule is applied exclusively to `domain.com`. For example a request from `domain.com` to `http://domain.com/icon.ico` is a first-party request. Request from `sub.domain.com` to `http://domain.com/icon.ico` is treated as a third-party (unlike the `$~third-party` modifier). +- domain.com$strict-first-party' — this rule applies only to `domain.com`. For example, a request from `domain.com` to `http://domain.com/icon.ico` is a first-party request. A request from `sub.domain.com` to `http://domain.com/icon.ico` is treated as a third-party one (as opposed to the `$~third-party` modifier). :::note -You may use a shorter name (alias) instead of using the full modifier name: `$strict1p`. +You can use a shorter name (alias) instead of using the full modifier name: `$strict1p`. ::: @@ -600,7 +600,7 @@ Works the same as the [`$third-party`](#third-party-modifier) modifier but also **Examples** -- `||domain.com^$strict-third-party` — this rule applies to all domains, except `domain.com`. An example of a third-party request: `http://sub.domain.com/banner.jpg` (unlike the `$third-party` modifier). +- `||domain.com^$strict-third-party` — this rule applies to all domains except `domain.com`. An example of a third-party request: `http://sub.domain.com/banner.jpg` (as opposed to the `$third-party` modifier). :::note @@ -610,7 +610,7 @@ You may use a shorter name (alias) instead of using the full modifier name: `$st #### **`$third-party`** {#third-party-modifier} -A restriction of third-party and own requests. A third-party request is a request from a different domain. For example, a request to `example.org` from `domain.com` is a third-party request. +A restriction on third-party and custom requests. A third-party request is a request from an external domain. For example, a request to `example.org` from `domain.com` is a third-party request. :::note From 1bd3781d56fc62038a442f0de819aa302d9fe4cc Mon Sep 17 00:00:00 2001 From: Andrey Yakushin Date: Tue, 25 Jun 2024 18:10:21 +0400 Subject: [PATCH 3/8] Apply one more suggestion --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 4bc99ee5d14..a2491ff4acc 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -604,7 +604,7 @@ Works the same as the [`$third-party`](#third-party-modifier) modifier but also :::note -You may use a shorter name (alias) instead of using the full modifier name: `$strict3p`. +You can use a shorter name (alias) instead of using the full modifier name: `$strict3p`. ::: From 66c758bd8a7e19fe74c147d86910d68140cd40d2 Mon Sep 17 00:00:00 2001 From: Andrey Yakushin Date: Thu, 11 Jul 2024 15:43:57 +0400 Subject: [PATCH 4/8] Extend modifiers compatible options with strict-party --- docs/general/ad-filtering/create-own-filters.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index a2491ff4acc..fa19426eaff 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -575,7 +575,7 @@ AdGuard will try to close the browser tab with any address that matches a blocki `$popup` modifier applies the `document` content type with a special flag which is passed to a blocking page. Blocking page itself can do some checks and close the window if it is really a popup. Otherwise, page should be loaded. - It can be combined with other request type modifiers, such as `$third-party` and `$important`. + It can be combined with other request type modifiers, such as `$third-party`, `$strict-third-party`, `$strict-first-party` and `$important`. - Rules with `$popup` modifier are not supported by AdGuard Content Blocker. ::: @@ -1264,7 +1264,7 @@ Here's how it works: :::caution Restrictions -`$cookie` rules support three types of modifiers: `$domain`, `$~domain`, `$important`, `$third-party`, and `$~third-party`. +`$cookie` rules support these types of modifiers: `$domain`, `$~domain`, `$important`, `$third-party`, `$~third-party`, `strict-third-party`, and `strict-first-party`. ::: @@ -1438,7 +1438,7 @@ preroll.ts :::caution Restrictions - `$hls` rules are only allowed [**in trusted filters**](#trusted-filters). -- `$hls` rules are compatible with the modifiers `$domain`, `$third-party`, `$app`, `$important`, `$match-case`, and `$xmlhttprequest` only. +- `$hls` rules are compatible with the modifiers `$domain`, `$third-party`, `$strict-third-party`, `$strict-first-party`, `$app`, `$important`, `$match-case`, and `$xmlhttprequest` only. - `$hls` rules only apply to HLS playlists, which are UTF-8 encoded text starting with the line `#EXTM3U`. Any other response will not be modified by these rules. - `$hls` rules do not apply if the size of the original response is more than 10 MB. @@ -1688,7 +1688,7 @@ In AdGuard for Windows, Mac and Android **running CoreLibs v1.11 or later**, JSO :::caution Restrictions -- `$jsonprune` rules are only compatible with these modifiers: `$domain`, `$third-party`, `$app`, `$important`, `$match-case`, and `$xmlhttprequest`. +- `$jsonprune` rules are only compatible with these modifiers: `$domain`, `$third-party`, `$strict-third-party`, `$strict-first-party`, `$app`, `$important`, `$match-case`, and `$xmlhttprequest`. - `$jsonprune` rules do not apply if the size of the original response is greater than 10 MB. ::: @@ -1928,7 +1928,7 @@ When multiple `$xmlprune` rules match the same request, they are applied in lexi :::caution Restrictions -- `$xmlprune` rules are only compatible with these modifiers: `$domain`, `$third-party`, `$app`, `$important`, `$match-case`, and `$xmlhttprequest`. +- `$xmlprune` rules are only compatible with these modifiers: `$domain`, `$third-party`, `$strict-third-party`, `$strict-first-party`, `$app`, `$important`, `$match-case`, and `$xmlhttprequest`. - `$xmlprune` rules do not apply if the size of the original response is greater than 10 MB. ::: @@ -2202,7 +2202,7 @@ This type of rules can be used [**only in trusted filters**](#trusted-filters). - `transfer-encoding` - `upgrade` -1. `$removeheader` rules are only compatible with `$domain`, `$third-party`, `$app`, `$important`, `$match-case`, and [content type modifiers](#content-type-modifiers) such as `$script` and `$stylesheet`. The rules which have any other modifiers are considered invalid and will be discarded. +1. `$removeheader` rules are only compatible with `$domain`, `$third-party`, `$strict-third-party`, `$strict-first-party`, `$app`, `$important`, `$match-case`, and [content type modifiers](#content-type-modifiers) such as `$script` and `$stylesheet`. The rules which have any other modifiers are considered invalid and will be discarded. ::: From a8b386aead1b315283581874d6c57837d5779669 Mon Sep 17 00:00:00 2001 From: Andrey Yakushin Date: Fri, 12 Jul 2024 14:00:02 +0400 Subject: [PATCH 5/8] Compatibility info --- docs/general/ad-filtering/create-own-filters.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index fa19426eaff..c93180bf7a4 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -594,6 +594,12 @@ You can use a shorter name (alias) instead of using the full modifier name: `$st ::: +:::info Compatibility + +Rules with the `$strict-first-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs](https://adguard.com/en/blog/introducing-corelibs.html) v1.16 or later. + +::: + #### **`$strict-third-party`** {#strict-third-party-modifier} Works the same as the [`$third-party`](#third-party-modifier) modifier but also treats requests from the domain to its subdomains and vice versa as third-party requests. @@ -608,6 +614,12 @@ You can use a shorter name (alias) instead of using the full modifier name: `$st ::: +:::info Compatibility + +Rules with the `$strict-third-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs](https://adguard.com/en/blog/introducing-corelibs.html) v1.16 or later. + +::: + #### **`$third-party`** {#third-party-modifier} A restriction on third-party and custom requests. A third-party request is a request from an external domain. For example, a request to `example.org` from `domain.com` is a third-party request. From 3301818e1861f0a2a32d6aa5d4dddf7389993ad6 Mon Sep 17 00:00:00 2001 From: Andrey Yakushin Date: Sat, 13 Jul 2024 01:52:39 +0400 Subject: [PATCH 6/8] Fix link to corelibs --- docs/general/ad-filtering/create-own-filters.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 980f69af04d..df17fa231a9 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -595,7 +595,7 @@ You can use a shorter name (alias) instead of using the full modifier name: `$st :::info Compatibility -Rules with the `$strict-first-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs](https://adguard.com/en/blog/introducing-corelibs.html) v1.16 or later. +Rules with the `$strict-first-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs] v1.16 or later. ::: @@ -615,7 +615,7 @@ You can use a shorter name (alias) instead of using the full modifier name: `$st :::info Compatibility -Rules with the `$strict-third-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs](https://adguard.com/en/blog/introducing-corelibs.html) v1.16 or later. +Rules with the `$strict-third-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs] v1.16 or later. ::: From 4236406a67d9bc23655e3ecb006b11e3778ffaf6 Mon Sep 17 00:00:00 2001 From: anyakushin <164042313+anyakushin@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:10:45 +0400 Subject: [PATCH 7/8] Add missing comma Co-authored-by: Helen <58733007+el-termikael@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index df17fa231a9..6aee09d602e 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -574,7 +574,7 @@ AdGuard will try to close the browser tab with any address that matches a blocki `$popup` modifier applies the `document` content type with a special flag which is passed to a blocking page. Blocking page itself can do some checks and close the window if it is really a popup. Otherwise, page should be loaded. - It can be combined with other request type modifiers, such as `$third-party`, `$strict-third-party`, `$strict-first-party` and `$important`. + It can be combined with other request type modifiers, such as `$third-party`, `$strict-third-party`, `$strict-first-party`, and `$important`. - Rules with `$popup` modifier are not supported by AdGuard Content Blocker. ::: From d083c301ac856d72bdfb030cb666d022838bc11f Mon Sep 17 00:00:00 2001 From: Andrey Yakushin Date: Tue, 20 Aug 2024 19:18:17 +0400 Subject: [PATCH 8/8] Fix compatibility table for strict party modifiers --- docs/general/ad-filtering/create-own-filters.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 772eaeee873..392d0e1dfd4 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -279,8 +279,8 @@ Basically, they just limit the scope of rule application. | [$match-case](#match-case-modifier) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | [$method](#method-modifier) | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | [$popup](#popup-modifier) | ✅ [***](#popup-modifier-limitations) | ✅ | ✅ | ✅ [***](#popup-modifier-limitations) | ✅ [***](#popup-modifier-limitations) | ❌ | -| [$strict-first-party](#strict-first-party-modifier) | 🧩 | ❌ | ❌ | ❌ | ❌ | ❌ | -| [$strict-third-party](#strict-third-party-modifier) | 🧩 | ❌ | ❌ | ❌ | ❌ | ❌ | +| [$strict-first-party](#strict-first-party-modifier) | ⏳ | ❌ | ❌ | ❌ | ❌ | ❌ | +| [$strict-third-party](#strict-third-party-modifier) | ⏳ | ❌ | ❌ | ❌ | ❌ | ❌ | | [$third-party](#third-party-modifier) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | [$to](#to-modifier) | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | @@ -289,6 +289,7 @@ Basically, they just limit the scope of rule application. - ✅ — fully supported - ✅ * — supported, but reliability may vary or limitations may occur; check the modifier description for more details - 🧩 — may already be implemented in nightly or beta versions but is not yet supported in release versions +- ⏳ — feature that has been implemented or is planned to be implemented but is not yet available in any product - ❌ — not supported :::