Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Security implications of loading user style file
Qt 6.11 is out! See what's new in the release blog

Security implications of loading user style file

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dan203
    wrote on last edited by
    #1

    I'm thinking about adding the ability for my users to load a custom style sheet into my app. Are there any security implications with doing that? Like could they type anything into the style sheet that would allow for some sort of attack? Or does Qt validate the style sheet well enough to prevent this?

    Right now I'm just loading the file as a QString and then calling setStyleSheet on the main dialog. All sub dialogs are loaded with a parent pointer so the style sheet propagates out.

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIR, if the stylesheet contains invalid syntax, it will simply not be applied.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        AFAIR, if the stylesheet contains invalid syntax, it will simply not be applied.

        D Offline
        D Offline
        Dan203
        wrote on last edited by
        #3

        @SGaist OK thanks. Just wanted to be sure before I exposed it.

        I really don't want to have to proxy custom styles for the handful of users who actually care about this. We had a system in our old version which was XML based and applied colors and a few other settings to custom drawn MFC controls, but we had maybe a dozen users who actually used it beyond the included styles that I personally wrote. Allowing those people to just edit the CSS would be so much easier.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          Since the file is being parsed on load, its hard to imagine how it can be used for an attack
          considering it is hard to instrument a buffer overflow or anything that would allow code execution.

          JoeCFDJ 1 Reply Last reply
          1
          • mrjjM mrjj

            Hi
            Since the file is being parsed on load, its hard to imagine how it can be used for an attack
            considering it is hard to instrument a buffer overflow or anything that would allow code execution.

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            @mrjj still risky. What if the file size is gigantic? Better to create a pop up for the user to add.

            D 1 Reply Last reply
            0
            • JoeCFDJ JoeCFD

              @mrjj still risky. What if the file size is gigantic? Better to create a pop up for the user to add.

              D Offline
              D Offline
              Dan203
              wrote on last edited by
              #6

              @JoeCFD Thanks for the input. I'll have to consider how I can limit that. I really want to avoid creating a whole UI for the user to modify the control looks. I did that before and no one ever used it. I want to offer the option to customize without any real effort on my part because very few people are going to actually use it.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved