SA-CONTRIB-2026-332: Critical severity composer/drupal/smart_trim vulnerability
This module implements a field formatter for text fields that improves the Summary or Trimmed formatter built into Drupal core. The module doesn't sufficiently escape unsafe HTML when passed through the module's Twig filter. This vulnerability is mitigated by the fact that an attacker must have a role with the ability to post content that gets passed through a Twig template with one of the |smarttrim filters provided by this module. If a site uses only use the field formatter without the Twig filter, it is not vulnerable.
Credit
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/drupal/smart_trimto a version that resolves this vulnerability.Fixed in 2.3.2Fixed in 2.2.2 - Configuration
Use only the module's field formatter and do not use the module's Twig filters (|smart_trim_*).
This module Twig filters = disabled
Event History
Frequently Asked Questions
Who is exposed to this issue?
Sites are exposed only when content from a user who can post content is passed through a Twig template using one of the module's |smart_trim_* filters. An attacker must hold a role permitted to submit that content.
Is a site affected if it uses Smart Trim only as a field formatter?
No. The issue does not affect sites that use only the module's field formatter and do not use its Twig |smart_trim_* filters.
What configuration should be reviewed during triage?
Review Twig templates for use of |smart_trim_* filters and determine whether user-submitted content can reach those filters. Also review which roles can post the relevant content.