Fixed
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
6 Oct 2026 at 17:40 UTC
Updated:
20 Oct 2026 at 16:11 UTC
Jump to comment: Most recent
MaxLength Words extends the MaxLength module so a field limit can be counted in words instead of characters.
It adds a "Count" option (Characters / Words) to the MaxLength widget settings. With "Words", a live word counter replaces MaxLength's character counter (same markup and styles, screen reader announcements), and with "Hard limit" the limit is trimmed while typing and enforced on submit, including CKEditor 5 fields.
Similar projects: MaxLength counts characters only; this module reuses its settings, messages, and styles instead of replacing them.
Comments
Comment #2
vishal.kadamComment #3
avpadernoThank you for applying!
Before giving links helpful to understand how the review process works, what to expect from a review, and what to do to avoid a review takes more time than needed, I would like to thank all the reviewers for the work they do.
These applications are volunters-driven, which also means it is not possible to predict when an application will be marked fixed and the applicant will get the permission to opt projects into security advisory policy. While we aim to make an application as quick as possible, it is also important for us that more people review the project used for an application. In this way, we make sure applications do not miss some important points that should be instead reported.
Applications are not meant to be complete debugging sessions that eliminate every existing bug, though. I apologize if sometimes applications seem to go into too-detailed reviews.
Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.
The important notes are the following.
Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
To the reviewers
Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.
The important notes are the following.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.
Comment #4
vishal.kadamComment #5
vishal.kadamFILE: maxlength_words.module
A new module that aims to be compatible with latest Drupal releases is expected to implement hooks as class methods as described in Support for object oriented hook implementations using autowired services.
Comment #6
avpadernoWe no longer use PAreview: project created less than ten days ago because applicants do not know what the issue tag means. More often, it confuses them, who think something needs to be done from their side.
Comment #7
daniel.matcau commented@vishal.kadam Thank you for the review in #5.
The hooks are now implemented as methods of
\Drupal\maxlength_words\Hook\MaxlengthWordsHooks, an autowired hook class (commit 773bc8a0 on 1.0.x).maxlength_words.modulekeeps only thin procedural wrappers marked with#[LegacyHook], which call the hook class on Drupal < 11.1 and are skipped on later versions.#[ReorderHook]on Drupal 11.2+, and withhook_module_implements_alter()(marked#[LegacyModuleImplementsAlter]) on earlier versions.WordCounterclass, covered by a unit test. A kernel test checks the hook order.Comment #8
jamestarletonReviewed
1.0.xat 773bc8a. I found no security issues: the count-down message is output as HTML the same way MaxLength does it, and the hard limit is also enforced on submit (core copies#element_validateto the text_formatvaluechild). CI passes on Drupal 10 and 11.One non-blocking bug:
WordCounter::count()andcountWords()injs/maxlength-words.jsalways strip<…>as tags, but string and link widgets hold plain text.x < y and z > wcounts as 2 words, and with "Hard limit" a 10-word title accepts any number of words placed between<and>(neither the JS trimming nor the server validation catches it).Suggest stripping tags and decoding entities only for
text*field types, e.g. a#maxwords_htmlflag /data-maxwords-htmlattribute set inconvertElement(), plus a unit test case for plain text with<.Comment #9
daniel.matcau commented@jamestarleton Thank you for the review in #8; good catch.
Fixed in commit 22705e35 on 1.0.x (released in 1.0.0-beta2):
text,text_long,text_with_summary).x < y and z > wnow counts as 5 words, and the hard limit can no longer be bypassed with angle brackets.<and>, and a kernel test that a string field with a hard limit of 3 words rejectsa <b c d e> f.CI passes on Drupal 11 and Drupal 10.
Comment #10
jamestarletonThanks @daniel.matcau. I checked 22705e35 (1.0.0-beta2): string and link fields are now counted as plain text in both
WordCounter::count()andcountWords().x < y and z > wcounts as 5 words, and a 10-word hard limit now rejectsone <two … eleven> twelve. CI is green, so the bypass from #8 is fixed.Comment #11
avpadernoThat test is checking
#[ReorderHook]works as expected, but that is already tested by Drupal core.Comment #12
avpadernoThank you for your contribution and for your patience with the review process!
I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.
These are some recommended readings to help you with maintainership:
You can find more contributors chatting on Slack or IRC in #drupal-contribute. So, come hang out and stay involved!
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank also all the reviewers for helping with these applications.
Comment #13
avpadernoComment #15
ruslan piskarovHey @daniel.matcau.
Congrats on your first module.
I know this task is already fixed; however, I want to propose a few improvements.
1. Add logo.svg or png for https://www.drupal.org/project/project_browser.
2. Since all hooks are already in web/modules/contrib/maxlength_words/src/Hook/MaxlengthWordsHooks.php
Create maxlength_words.services.yml file with
It will add a little performance improvement when creating the cache and rebuilding hooks.
Comment #16
daniel.matcau commented@ruslan-piskarov Thank you!
Both are already done in 1.0.0: the logo for Project Browser and
skip_procedural_hook_scan.Drupal 12 compatibility will come once MaxLength, which this module depends on, supports Drupal 12.