Skip to content

Add limited support for $cookie rules #54

Description

@ameshkov

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions