95326[BUGFIX] Escape search term of selectTree filter
Commit message
Review
-
Code review CR +2 Done
- Georg Ringer +2
- Benjamin Franzke +1
- Stefan Bürk +1
- Benjamin Kott +1
-
Verified V +2 Done
- Georg Ringer +2
- Benjamin Franzke +1
- Benjamin Kott +1
- core-ci +1 CI
Issues 1
Files 3
Review log 810
-
Georg Ringer uploaded patch set 1 08/13/26, 19:25
-
Georg Ringer commented on patch set 1 08/13/26, 19:25
This change is ready for review. -
core-ci voted on patch set 1 V +1 08/13/26, 19:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106676
-
Markus Klein updated the commit message in patch set 2
V +108/14/26, 22:24 -
core-ci voted on patch set 2 V +1 08/14/26, 22:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106734
-
Stefan Bürk commented on patch set 2 CR +1 08/15/26, 18:07
Unresolved
The fix itself is right, and I like that it removes the RegExp rather than escaping into it: that also takes the ReDoS hazard of a user-typed pattern off the table, and it lines the filter up with Tree.createNodeContentLabel(), which already escaped the term to a literal for highlighting. It matches existing precedent (form/backend/form-editor-tree.ts:223, backend/settings/editor.ts:453). The unit test is exactly the right one, and since the import map resolves @typo3/backend/ to the compiled output it also covers the regenerated artifact. I checked the HTML side too: the highlighter renders through lit text bindings, so there is no XSS here and nothing further to escape. Three things before this goes in: 1. Subject. Nothing is escaped by this patch - the escaping is made unnecessary. "Escape search term..." also makes it read as security-relevant, which it is not: self-typed input, own tab, RegExp compile error, no injection. Something like "[BUGFIX] Match selectTree filter term literally" (46 chars) would describe what happens. Same for the body sentence "This is the same comparison the escaped RegExp performed" - there never was an escaped RegExp in this file. And strictly, the input handler is not permanently killed: the next keystroke calls filter() again, so the filter stops updating while the term is unbalanced rather than dying. 2. Releases: main, 14.3 - is 13.4 left out deliberately? origin/13.4:Build/Sources/TypeScript/backend/form-engine/element/select-tree.ts:87 has the same new RegExp(searchTerm, 'i'), 13.4 is still taking bugfixes, the test directory exists there, and the counterpart #107565 was backported to 13.4 as well. 3. Consistency with 95325: once both land, the side-by-side filter ignores diacritics and this one does not, so "creme" finds "Creme brulee" in one FormEngine field type and not in the other. #110482 closes on exactly that point. Could the normalize-and-compare move into one shared helper used by both? Counting form-editor-tree.ts and settings/editor.ts::matchesSubstring() we are at four near-identical copies. If diacritics are out of scope here, a follow-up issue referenced from the message would be enough for me. Two nits, take or leave: this.searchTerm = searchTerm; is left un-normalized while the new local uses ?? '' (the base Tree.filter() guards with typeof searchTerm === 'string'), and the (node: any) in the loop could now be TreeNodeInterface. Out of scope, but found while looking for siblings and worth their own issues: the same unescaped-RegExp-on-typed-input pattern is still live in backend/new-record-wizard.ts:521/:525, backend/column-selector-button.ts:126 and extensionmanager/main.ts:190. And Tree.getFilterUrl() (tree/tree.ts:209) concatenates the search term into the query string without encodeURIComponent(), so a & or # corrupts the page-tree filter request. -
Benjamin Kott voted on patch set 2 CR +1 V +1 08/28/26, 09:17
-
Benjamin Franzke voted on patch set 2 CR +1 V +1 08/28/26, 09:23
-
Georg Ringer voted on patch set 2 CR +2 V +2 08/28/26, 09:34
-
Georg Ringer merged patch set 3 08/28/26, 09:34