Problem/Motivation

In #3516706-83: Disallow dangerous filenames e.g. command injection characters @ghost of Drupal past pointed out that \Drupal\Component\Utility\Unicode::PREG_CLASS_WORD_BOUNDARY maintained a discrete list of characters rather than using the \p character class patterns.

This was because of a #604002-54: Poor search support of some Unicode scripts bug found with \p 17 years ago.

That bug may no longer be present

Steps to reproduce

Proposed resolution

Adapt SearchTextProcessorTest from search module into a unit test for Unicode word boundaries
Simplify the pattern on \Drupal\Component\Utility\Unicode::PREG_CLASS_WORD_BOUNDARY and see if tests pass

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3624695

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

larowlan created an issue. See original summary.

larowlan’s picture

Status: Active » Needs review

The UnicodeTest still passes with this MR - let's see what else breaks

ghost of drupal past’s picture

The problem is not UnicodeTest, the real test ended up in SearchTextProcessorTest which I understand is to be moved into contrib. Since parent got committed, the \p test is now security weight bearing and as such UnicodeTest.txt must be moved to core and the \p test added to UnicodeTest.

larowlan’s picture

Pushed the search test module fixture and matching unit test case.

There are 4 fails:

- U+06DE ARABIC START OF RUB EL HIZB is now Other_Symbol - so that's different to how we were classifying it - should be stripped as its a symbol.
- U+0CF1, U+0CF2 (Kannada signs) - these are now Other_Letter - we were stripping but should be retained now
- U+17B4, U+17B5 (Khmer inherent vowels) - these are now NonSpacing_Mark so should be retained
- U+3248-U+324F (circled numbers on black square) these are now Other_Number so should be retained

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new11.65 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

ghost of drupal past’s picture

Perhaps the issue title should reflect the fact you are exploring whether \p is bug free this time because security. That we have a test for this already for PREG_CLASS_WORD_BOUNDARY is a useful side effect but not the point.

larowlan’s picture

Title: Explore whether \Drupal\Component\Utility\Unicode::PREG_CLASS_WORD_BOUNDARY can be simplified » Explore whether \p is bug free for security
Issue summary: View changes

Sure

So for the four fails I think we need to update the text fixture to match the current classification of those characters

xjm’s picture

This is definitely going to need eyes. :)

mcdruid made their first commit to this issue’s fork.