5 votes

Userstyle issues

Tags: css

I had a look at the available themes and being a person who is sometimes inclined to rice, decided to port my colourscheme to tildes using the Stylish firefox extension. Unfortunately,
Content Security Policy: The page's settings blocked the loading of a resource at self ("style-src")

comes up in the debugger on every page. How can I work around this?

12 comments

  1. [2]
    Deimos
    Link
    This is because Tildes has an extremely restrictive Content Security Policy, which prevents a lot of "injection" techniques from working (and should make XSS and some similar attacks impossible)....

    This is because Tildes has an extremely restrictive Content Security Policy, which prevents a lot of "injection" techniques from working (and should make XSS and some similar attacks impossible).

    I could probably loosen it a bit for CSS though, if it's preventing styling extensions from working.

    4 votes
    1. tan
      Link Parent
      Yeah, certainly prevented this injection :p. For whatever reason, using the Stylus extension instead of Stylish fixed the issue. Stylus is a fork of Stylish, so maybe it's added a workaround for...

      Yeah, certainly prevented this injection :p. For whatever reason, using the Stylus extension instead of Stylish fixed the issue. Stylus is a fork of Stylish, so maybe it's added a workaround for this problem.

      2 votes
  2. [4]
    thykka
    Link
    I haven't tried customizing ~ with Stylish, but my Tampermonkey script gave the same error at first. Fixed it by using TM:s own style injection function GM_addStyle(CSSstring), instead of standard...

    I haven't tried customizing ~ with Stylish, but my Tampermonkey script gave the same error at first.

    Fixed it by using TM:s own style injection function GM_addStyle(CSSstring), instead of standard DOM methods. As far as I know, Stylish only allows CSS, so this fix probably isn't applicable there.

    This seems to be a known bug in Stylish. OTOH the CSP specification states;

    Policy enforced on a resource SHOULD NOT interfere with the operation of user-agent features like addons, extensions, or bookmarklets.

    ...so in that sense it could be a bug in Firefox.

    2 votes
    1. [3]
      tan
      Link Parent
      Thanks for the tip, I've been meaning to try Tampermonkey for ages but haven't actually gotten round to it, so it's nice to know this could use it. For this particular issue, Stylus seems to work,...

      Thanks for the tip, I've been meaning to try Tampermonkey for ages but haven't actually gotten round to it, so it's nice to know this could use it.

      For this particular issue, Stylus seems to work, so probably a Stylish issue and not Firefox.

      1. [2]
        thykka
        Link Parent
        Well, in case you want something to start with, feel free to fork my userscript. It's basically a time-based day/night theme switcher, but it can also add custom CSS.

        Well, in case you want something to start with, feel free to fork my userscript. It's basically a time-based day/night theme switcher, but it can also add custom CSS.

        1 vote
        1. tan
          Link Parent
          Nice, I like it

          Nice, I like it

  3. [7]
    Comment deleted by author
    Link
    1. [6]
      tan
      Link Parent
      Hmm, thanks. In tildes.css, the four existing themes are all defined, and if I just paste my theme in there with them, it works (if I also set the theme cookie to my theme), so I suspect Stylish...

      Hmm, thanks. In tildes.css, the four existing themes are all defined, and if I just paste my theme in there with them, it works (if I also set the theme cookie to my theme), so I suspect Stylish is really being blocked.

      1 vote
      1. [6]
        Comment deleted by author
        Link Parent
        1. [5]
          tan
          Link Parent
          what? I am using Stylish, that's what prompted this thread

          what? I am using Stylish, that's what prompted this thread

          2 votes
          1. [5]
            Comment deleted by author
            Link Parent
            1. [4]
              tan
              Link Parent
              Ah nice, Stylus just works somehow.

              Ah nice, Stylus just works somehow.

              2 votes
              1. [4]
                Comment deleted by author
                Link Parent
                1. [3]
                  tan
                  Link Parent
                  Sure, here it is (still pretty ugly imo, I want to work on it some more): http://up.unix.porn/1U6N.txt

                  Sure, here it is (still pretty ugly imo, I want to work on it some more): http://up.unix.porn/1U6N.txt

                  1 vote
                  1. [3]
                    Comment deleted by author
                    Link Parent
                    1. [2]
                      tan
                      Link Parent
                      Ooh, I think I like yours more. We should make a repo or something for alternative themes. Thanks, the domain belongs to a friend of mine and I host a little private upload service on the...

                      Ooh, I think I like yours more. We should make a repo or something for alternative themes. Thanks, the domain belongs to a friend of mine and I host a little private upload service on the subdomain (though it's still missing a lot of features)

                      1. [2]
                        Comment deleted by author
                        Link Parent
                        1. tan
                          Link Parent
                          Nice, something to keep an eye on there. Have fun with the theme - I just made a few colour edits to mine: http://up.unix.porn/C4Lp.txt Yeah, I originally wrote the upload service specifically for...

                          Nice, something to keep an eye on there. Have fun with the theme - I just made a few colour edits to mine: http://up.unix.porn/C4Lp.txt

                          Yeah, I originally wrote the upload service specifically for a Telegram rice chat we're in, so unixporn comes up a lot.

                          1 vote