Skip to content

Commit

Permalink
Merge pull request #418 from ngorskikh/feature/AG-29404
Browse files Browse the repository at this point in the history
Update the `$permissions` modifier documentation
  • Loading branch information
vbagirov authored Aug 1, 2024
2 parents 12816f5 + f8d06dc commit 9441093
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docs/general/ad-filtering/create-own-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -1954,10 +1954,12 @@ For the requests matching a `$permissions` rule, AdGuard strengthens response's

**Syntax**

`$permissions` value syntax is similar to the `Permissions-Policy` header [syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy) with one exception: comma that separates several features **MUST** be escaped.
Pipe separator `|` instead of escaped comma is supported as well for better compatibility — see examples below.
`$permissions` value syntax is identical to that of the `Permissions-Policy` header [syntax](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy) with the following exceptions:

The list of the available directives is available [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#directives).
1. A comma that separates multiple features **MUST** be escaped — see examples below.
2. A pipe character (`|`) can be used to separate features instead of a comma.

The list of available directives is available [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#directives).

`$permissions` value can be empty in the case of exception rules — see examples below.

Expand All @@ -1967,7 +1969,7 @@ The list of the available directives is available [here](https://developer.mozil
- `@@||example.org/page/*$permissions=autoplay=()` disables all rules with the `$permissions` modifier exactly matching `autoplay=()` on all the pages matching the rule pattern. For instance, the rule above. It is important to note that the exception rule only takes effect in the case of an **exact value match**. For example, if you want to disable the rule `$permissions=a=()\,b=()`, you need exception rule `@@$permissions=a=()\,b=()`, and **not** `@@$permissions=b=()\,a=()`, **nor** `@@$permissions=b=()` because `b=()\,a=()` or `b=()` does not match with `a=()\,b=()`.
- `@@||example.org/page/*$permissions` disables all the `$permissions` rules on all the pages matching the rule pattern.
- `$domain=example.org|example.com,permissions=storage-access=()\, camera=()` disallows using the Storage Access API to request access to unpartitioned cookies and using video input devices across `example.org` and `example.com`.
- `||example.org^$permissions=storage-access=()|camera=()` — for better compatibility, we also support pipe-separated values for `$permissions` modifier.
- `$domain=example.org|example.com,permissions=storage-access=()|camera=()` does the same — a `|` can be used to separate the features instead of an escaped comma.
- `@@||example.org^$document` or `@@||example.org^$urlblock` disables all the `$permission` rules on all the pages matching the rule pattern.

:::note
Expand All @@ -1992,8 +1994,9 @@ Firefox ignores the `Permissions-Policy` header. For more information, see [this

:::caution Restrictions

1. Characters forbidden in the `$permissions` value: `$`
1. `$permissions` is compatible with three types of modifiers: `$domain`, `$important`, and `$subdocument`.
1. Characters forbidden in the `$permissions` value: `$`.
2. `$permissions` is compatible with a limited set of modifiers: `$domain`, `$important`, `$subdocument`, and [content-type modifiers](#content-type-modifiers).
3. `$permissions` rules that do not have any [content-type modifiers](#content-type-modifiers) will match only requests where content type is `document`.

:::

Expand Down

0 comments on commit 9441093

Please sign in to comment.