Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Description for strict-first-party and strict-third-party modifiers #517

Merged
merged 10 commits into from
Aug 20, 2024
59 changes: 52 additions & 7 deletions docs/general/ad-filtering/create-own-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +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) | ⏳ | ❌ | ❌ | ❌ | ❌ | ❌ |
| [$third-party](#third-party-modifier) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [$to](#to-modifier) | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |

Expand All @@ -287,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

:::
Expand Down Expand Up @@ -588,7 +591,7 @@ AdGuard will try to close the browser tab with any address that matches a blocki
The `$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`.

:::

Expand All @@ -598,9 +601,49 @@ Rules with the `$popup` modifier are not supported by AdGuard Content Blocker.

:::

#### **`$strict-first-party`** {#strict-first-party-modifier}

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 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 can use a shorter name (alias) instead of using the full modifier name: `$strict1p`.

:::

anyakushin marked this conversation as resolved.
Show resolved Hide resolved
:::info Compatibility

Rules with the `$strict-first-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs] 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.

**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` (as opposed to the `$third-party` modifier).

:::note

You can use a shorter name (alias) instead of using the full modifier name: `$strict3p`.

:::

:::info Compatibility

Rules with the `$strict-third-party` modifier are supported by AdGuard for Windows, Mac, and Android with [CoreLibs] v1.16 or later.

:::

#### **`$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

Expand Down Expand Up @@ -1253,7 +1296,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`.

:::

Expand Down Expand Up @@ -1427,7 +1470,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.
Expand Down Expand Up @@ -1677,7 +1720,7 @@ In AdGuard for Windows, Mac and Android with [CoreLibs] v1.11 or later, JSONPath

:::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.

:::
Expand Down Expand Up @@ -1917,7 +1960,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.

:::
Expand Down Expand Up @@ -2213,7 +2256,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.

:::

Expand Down Expand Up @@ -2638,6 +2681,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 `~`.
Expand Down
Loading