Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.3.16, 2.4.6
-
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