Skip to content
This repository was archived by the owner on Oct 24, 2020. It is now read-only.
This repository was archived by the owner on Oct 24, 2020. It is now read-only.

Scriptlet injection banned by CSP #26

Open

Description

@DrIT2016

Describe the issue (Required)

Extra resources of nano (e.g. nanop-click-elements-onready.js) mostly don't work when using it in own filters (and setting advanced setting ""). While the exact same rules do work in chrome. So looks like problem with firefox version to use these extra resources correctly?

Screenshots (Required)

Screenshot of console (Required, press F12 to open the console)

gelderlander

URLs where this issue occurs (Required if applicable)

https://radar.avrotros.nl/
https://www.gelderlander.nl

Reproduction Steps (Optional if trivial)

Go to site and see cookie wall/cookie message not getting clicked. Do it in chrome and the button will get clicked.

Anything else you believe to be useful (Optional)

Environment (Required)

  • Operating System and Version: Win 7
  • Browser and Version: Firefox/Waterfox latest
  • Nano Adblocker Version: latest
  • Nano Defender Version (Optional if you are not using it): lateset

Your filter lists (Required)

ootb

Your custom filters (Required if you have any)

avrotros.nl##+js(nanop-click-elements-onload.js, button.ccm_btn:nth-child(1))
myprivacy.persgroep.net##+js(nanop-click-elements-onready.js, button.button:nth-child(3))

Activity

  1. added
    bug
    on Aug 3, 2019
  2. LiCybora commented on Aug 3, 2019

    @LiCybora
    Owner

    My guess is race condition. Because your rules works for me when I clicking into another site. It just not works with refreshing page.

    Edit: I tried Chromium (not Chrome) and it also not click the button sometimes.

  3. added
    WIP
    on Aug 3, 2019
  4. LiCybora commented on Aug 3, 2019

    @LiCybora
    Owner
  5. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017

    If onready is too early, try onload.

  6. LiCybora commented on Aug 3, 2019

    @LiCybora
    Owner

    The first one is already onload but still fail.
    The second one will not work due to the CSP block all inline script, not sure how it can work on Chrome.
    image

    image

    Btw, @jspenguin2017 how about add optional third argument for delay the click execution in the snippet?

  7. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017

    Inline scripts injected by extensions should bypass CSP.

  8. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017

    Allowing timeout would allow complex operations, which has security implications. Although privileged script snippets are suppose to be powerful, they should not be too dangerous. I'll need to think about it.

  9. LiCybora commented on Aug 3, 2019

    @LiCybora
    Owner

    Inline scripts injected by extensions should bypass CSP.

    Yes if they are injected via Content Script (that's why ND activation console is not affected). However, snippet injection is via creation of <script> node to the document, which is therefore inline(?). But it works on Chromium, I may need to check documentation.

    Edit: See https://bugzilla.mozilla.org/show_bug.cgi?id=1267027

    Allowing timeout ...

    The reason I ask for setTimeout is because the button is created by xhr via script, not the document itself. This cause the button not available during document ready state claimed as complete, and thus the clicking script not always work.

    In worst situation, consider fixing in ND...

  10. added
    Browser Bug
    and removed
    bug
    on Aug 3, 2019
  11. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017
  12. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017

    I know the script snippets don't always work, and I have never claimed that they do. As I said, allowing custom timeout may have security implications, and I have to think about it.

    I will not add annoyance fixes to ND.

  13. added
    wontfix
    and removed
    WIP
    on Aug 3, 2019
  14. LiCybora commented on Aug 3, 2019

    @LiCybora
    Owner

    1st site will not be fixed due to limitation of snippets.
    2nd site is affected by browser bug. Issue will keep open until workaround is done or Mozilla fix it. I may try the workaround if I have time.

  15. changed the title [-]Extra resources not working correctly[/-] [+]Scriptlet injection banned by CSP[/+] on Aug 3, 2019
  16. DrIT2016 commented on Aug 3, 2019

    @DrIT2016
    Author

    So if i understand correctly, some sites do not work with these snippets because of limitation? Strange i got it working with NB on Vivaldi (i said chrome, but tested with Vivaldi).
    Other sites work fine like f.e hardware.info##+js(nanop-click-elements-onload.js, #decision), that's because these sites don't have this limitation?
    Is there something i can do myself to get it working? Don't want to go back to i don't care about cookies addon, so hopefully there's something (maybe an other script click mechanism with addon or greasyfork or something)?

  17. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017

    The first site is a won't fix as per Filters Policy: https://github.com/NanoAdblocker/NanoFilters

    I'll land a fix for the second site for Chromium.

  18. jspenguin2017 commented on Aug 3, 2019

    @jspenguin2017

    The privileged script snippets are not designed to be a replacement for I Don't Care About Cookies. You can make an Userscript or extension for yourself to implement missing pieces.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Browser Bugwontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions