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

Website CSP can block AdGuard scripts in Firefox #1733

Closed
HanabishiRecca opened this issue Dec 11, 2020 · 20 comments
Closed

Website CSP can block AdGuard scripts in Firefox #1733

HanabishiRecca opened this issue Dec 11, 2020 · 20 comments

Comments

@HanabishiRecca
Copy link

HanabishiRecca commented Dec 11, 2020

  • AdGuard version: 3.5.23
  • Browser and version: Firefox 83.0

Some websites using strict CSP rules can block AdGuard scripts injection.
E.g. here at github.com AdGuard can't make it's own scripts to work.
image
So all JS-related filters doesn't work with the such websites.

I've tried to override this behavior with a rule like this:
github.com^$csp=script-src 'unsafe-inline' 'unsafe-eval' *
But it doesn't work for some reason.

This is Firefox-only issue. Seems like Chrome allows extensions to inject scripts regardless of CSP.
For a practical example, try to use a such rule:
github.com#%#alert('Hi')
It works in Chrome, but not in Firefox.

@Chinaski1
Copy link
Member

Hello!

It looks like there should be no CSP check for extension resources.
Apparently, this is a bug in the Firefox browser.

@isaak654
Copy link

I constantly see a red Content Security Policy warning in Firefox Console during the normal navigation on Github.com too.

firefox_console

I'm using Firefox 84.0.2 x64. With the same browser I can't make more than 5 edits to a comment because my changes are not correctly retained between an edit and another. Currently I'm waiting official Github confirmation about it.

I've already tried without success:

  1. to disable "Filter update interval" option in Adguard
  2. to include github.com in the Adguard whitelist

@HanabishiRecca
Copy link
Author

With the same browser I can't make more than 5 edits to a comment because my changes are not correctly retained between an edit and another.

I don't think this is related. CSP errors means exactly the opposite: Adguard scripts don't work at this website. So there is literally nothing to interfere with.

@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Wontfix label Jun 2, 2021
@stale stale bot removed the Wontfix label Jun 2, 2021
@stale
Copy link

stale bot commented Aug 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@XX-J
Copy link

XX-J commented Dec 5, 2021

А я то думал, - почему scriptlet'ы на некоторых сайтах не работают, а тут вон оно что...
Не работают scriptlet'ы на GitHub'е, Яндексе и других сайтах, где они ОЧЕНЬ нужны.

Система Фильтры Антитрекинг
AdGuard v3.6.13 Базовый AdGuard         Русский Стандарт
FireFox v78.13 ESR Счётчиков и аналитики         Отслеживания по URL +Блокировка WebRTC
Win7SP1 Виджетов социальных сетей         Раздражителей +Удаление параметров отслеживания

@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@XX-J
Copy link

XX-J commented Aug 27, 2022

Workaround this bug in FireFox is put security.csp.enable = false in about:config.

Странно, но GreaseMonkey как-то обходит эту проблему, а AdGuard и TamperMonkey - нет. Почему и, самое главное, Как?

@github-actions github-actions bot removed the Wontfix label Aug 27, 2022
@HanabishiRecca
Copy link
Author

Workaround this bug in FireFox is put security.csp.enable = false in about:config.

Довольно жестоко глобально отключать CSP, безопасность страдает.

Странно, но GreaseMonkey как-то обходит эту проблему

Точно? Тогда нужно покопаться в его исходнике просто.

@XX-J
Copy link

XX-J commented Aug 27, 2022

Точно? Тогда нужно покопаться в его исходнике просто.

Точно! Использую версию 4.11 на FireFox v78.13 ESR, только он в iframe'ах скрипты не запускает. А TamperMonkey работает в iframe'ах, но не работает при строгом CSP.

А в коде я настолько сильно не разбираюсь - надо более опытного кодера.

@adguard-bot adguard-bot assigned slavaleleka and unassigned maximtop Apr 12, 2024
@slavaleleka slavaleleka changed the title Website CSP can block AdGuard scripts (Firefox) Website CSP can block AdGuard scripts in Firefox Apr 15, 2024
adguard pushed a commit to AdguardTeam/tsurlfilter that referenced this issue Apr 15, 2024
AdguardTeam/AdguardBrowserExtension#1733

Squashed commit of the following:

commit c88fe90
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Mon Apr 15 15:01:32 2024 +0400

    fix comment

commit b6947c5
Merge: f156e6a cb4a3a6
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Mon Apr 15 15:00:03 2024 +0400

    merge master into the branch, resolve conflicts

commit f156e6a
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Mon Apr 15 14:58:32 2024 +0400

    fix script rules applying in ff
adguard pushed a commit that referenced this issue Apr 18, 2024
Squashed commit of the following:

commit c7014e6
Merge: 9c5c0b8 ceb809c
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Thu Apr 18 14:59:30 2024 +0400

    merge master into the branch, resolve conflicts

commit 9c5c0b8
Author: Slava Leleka <v.leleka@adguard.com>
Date:   Mon Apr 15 21:05:45 2024 +0400

    update tswebextension to v1.0.24
adguard pushed a commit that referenced this issue May 16, 2024
…n readme

Merge in EXTENSIONS/browser-extension from feature/template_update to master

Squashed commit of the following:

commit 9ee7a1e
Author: Maria Giganova <mg@adguard.com>
Date:   Wed May 15 18:52:05 2024 +0300

    📜 Docs: fix typos

commit 7e86dde
Author: Maria Giganova <mg@adguard.com>
Date:   Wed May 15 17:55:04 2024 +0300

    📜 Docs: fix link

commit 98122a4
Author: Maria Giganova <mg@adguard.com>
Date:   Wed May 15 14:54:12 2024 +0300

    📜 Docs: update templates, add badge for mozilla in readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
@isaak654 @HanabishiRecca @maximtop @XX-J @adguard-bot @slavaleleka @Chinaski1 and others