#110796Strip MySQL fulltext operators from search words in boolean mode
Description
Problem
When indexed_search uses the MySQL fulltext search (enableFulltextSearch / useMysqlFulltext), the search words are concatenated into an AGAINST('...' IN BOOLEAN MODE) expression in IndexSearchRepository::getSearchString(). Only the double quote is removed for sentence searches. The other boolean-mode operators ( ) < > ~ *@ and " stay in the word and are handed to the database.
A frontend user who enters e.g. foo(, ", +, @ or < in the search field, or uses the part-of-word search type (which forces boolean mode), gets a SQL syntax error from MySQL/MariaDB (“syntax error, unexpected …”), so the search result page fails instead of showing “no results”. Operators in the middle of a word also silently change the meaning of the query.
The value is bound/quoted, so this is not an SQL injection. It is a robustness bug: user input is interpreted as query syntax.
Steps to reproduce
- Enable the MySQL fulltext search in indexed_search.
- Search for
fo(oor"orfoo~with search type “part of word”. - Observe the database exception (HTTP 500) instead of an empty result.
Expected behaviour
Operator characters in user-provided search words are removed before building the boolean expression. The operators that indexed_search adds itself (+, -, * and the quotes of sentence searches) must stay.
Fix
Strip ( ) < > ~ “ * +@ and - from the individual search word in getSearchString() before the indexer-controlled prefix/suffix is
added. Covered by a unit test.
Found during an audit of EXT:indexed_search, see also #110782 to #110788.
Reviews 1
History 12
-
Gerrit Code Review pushed patch set 1 for main to change 96086 status
NewUnder Review <span data-processor="relativetime" data-value="2026-09-25T17:02:31+00:00" > 09/25/26, 17:02 </span> -
Benni Mack commented and changed status
Under ReviewRejected <span data-processor="relativetime" data-value="2026-11-19T16:56:31+00:00" > 11/19/26, 16:56 </span>
wont do