Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-2859

Strings with newlines break configuration serialization

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.16, 2.4.6
    • Fix Version/s: 2.3.17, 2.4.7, 2.5.0
    • Component/s: Core
    • Labels:
      None

      Description

      The REST API does not validate the input string in a way that would prevent it from breaking the configuration serialization. Strings with an embedded newlines must be rejected.


      Original description:

      The following regex

      (?x) start #comment
      end
      

      is a valid regex with comments enabled.
      It should match "startend"
      The Maxscale REST API allows creating of such regexes and they function as expected, but the resulting .cnf file ine "/var/lib/maxscale/maxscale/cnf.d/" is invalid, as it contains a new line.

      [replication_filter]
      type=filter
      module=binlogfilter
      match=(?#test1)(?x) start #comment
      end
      exclude=something
      rewrite_src=something
      rewrite_dest=something
      

      The REST API returns the following JSON for this filter

                  "parameters": {
                      "match": "(?x) start #comment\nend",
                      "exclude": "something",
                      "rewrite_src": "something",
                      "rewrite_dest": "something"
                  }
      

      The discrepancy between the json and .cnf representations means that after a maxscale restart the .cnf will be loaded and maxscale will crash as this is not a valid .cnf file

        Attachments

          Activity

            People

            Assignee:
            markus makela markus makela
            Reporter:
            petko.vasilev Petko Vasilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: