AdguardTeam / AdguardTeam/SafariConverterLib

Add limited support for `$cookie` rules

未關閉
#54 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement Priority: P4
主要語言
Swift
星號
78
分支
20
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。