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

Add limited support for $cookie rules #54

Open
ameshkov opened this issue Aug 7, 2023 · 3 comments
Open

Add limited support for $cookie rules #54

ameshkov opened this issue Aug 7, 2023 · 3 comments
Labels
enhancement New feature or request Priority: P4

Comments

@ameshkov
Copy link
Member

ameshkov commented Aug 7, 2023

Safari content blocking API provides rules with action block-cookies:

Strips cookies from the header before sending it to the server. This only blocks cookies otherwise acceptable to Safari's privacy policy. Combining with ignore-previous-rules doesn't override the browser’s privacy settings.

This is nothing compared to what $cookie rules are capable of in other AdGuard versions. However, we can improve the situation a little bit if we accompany block-cookie content blocking rules with "advanced rules". The purpose of the "advanced rules" will be to use Javascript and remove cookies via document.cookie.

Briefly, here's what I suggest.

A rule like that: $cookie=test,domain=google.com

Should be converted to two rules.

  • One is a safari content blocking API rule: { trigger: { "if-domain": "google.com*" }, "action": { type: "block-cookies" } }.
  • The other one is an advanced rule that will run a script removing the cookie using document.cookie

This is certainly far from the $cookie rules capabilities, but it's better than nothing anyways.

@ameshkov ameshkov added the enhancement New feature or request label Aug 7, 2023
@petrossauro
Copy link

petrossauro commented Aug 10, 2023

One of the apps I tested to “block” cookies had an issue that severely degraded performance because it kept polling and removing the cookies always.
Personally speaking, I’d rather have something that set the cookies to expire at the end of the day or the session, if the other solutions have performance tradeoffs.

@ameshkov
Copy link
Member Author

In the case of AdGuard we rely on filters that tell AdGuard what to do, it's not a generic solution for clearing all cookies or something like that, it's just a way to implement at least partly a type of rules that are supported by other AdGuard versions.

@petrossauro
Copy link

petrossauro commented Aug 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority: P4
Projects
None yet
Development

No branches or pull requests

3 participants