Skip to content

Update dependency league/commonmark to ^2.8.1 [SECURITY]#71

Open
renovate[bot] wants to merge 1 commit intostagingfrom
renovate/packagist-league-commonmark-vulnerability
Open

Update dependency league/commonmark to ^2.8.1 [SECURITY]#71
renovate[bot] wants to merge 1 commit intostagingfrom
renovate/packagist-league-commonmark-vulnerability

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 10, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
league/commonmark (source) ^2.4.2^2.8.1 age adoption passing confidence

GitHub Vulnerability Alerts

GHSA-c2pc-g5qf-rfrf

Impact

Several polynomial time complexity issues in league/commonmark may lead to unbounded resource exhaustion and subsequent denial of service.

Malicious users could trigger that inefficient code with carefully crafted Markdown inputs that are specifically designed to ensure the worst-case performance is reached. Sending multiple such requests in parallel could tie up all available CPU resources and/or PHP-FPM processes, leading to denial of service for legitimate users.

Patches

These vulnerabilities have been patched in version 2.6.0. All users on older versions are highly encouraged to upgrade as soon as possible.

Workarounds

If you cannot upgrade, you may be able to mitigate the issues by:

  • Setting very low memory_limit and max_execution_time PHP configurations to prevent runaway resource usage
  • Implementing rate-limiting, bot protection, or other approaches to reduce the risk of simultaneous bad requests hitting your site
  • Limiting the size of inputs fed into this library (specifically the max length of each line)
  • Limiting the use of this library to trusted users

References

Most of these issues were discovered in other Markdown parsers. You can read more about them here:

For general information about this type of issue:

CVE-2025-46734

Summary

Cross-site scripting (XSS) vulnerability in the Attributes extension of the league/commonmark library (versions 1.5.0 through 2.6.x) allows remote attackers to insert malicious JavaScript calls into HTML.

Details

The league/commonmark library provides configuration options such as html_input: 'strip' and allow_unsafe_links: false to mitigate cross-site scripting (XSS) attacks by stripping raw HTML and disallowing unsafe links. However, when the Attributes Extension is enabled, it introduces a way for users to inject arbitrary HTML attributes into elements via Markdown syntax using curly braces.

As a result, even with the secure configuration shown above, an attacker can inject dangerous attributes into applications using this extension via a payload such as:

![](){onerror=alert(1)}

Which results in the following HTML:

<p><img onerror="alert(1)" src="" alt="" /></p>

Which causes the JS to execute immediately on page load.

Patches

Version 2.7.0 contains three changes to prevent this XSS attack vector:

Workarounds

If upgrading is not feasible, please consider:

CVE-2026-30838

Impact

The DisallowedRawHtml extension can be bypassed by inserting a newline, tab, or other ASCII whitespace character between a disallowed HTML tag name and the closing >. For example, <script\n> would pass through unfiltered and be rendered as a valid HTML tag by browsers. This is a cross-site scripting (XSS) vector for any application that relies on this extension to sanitize untrusted user input.

All applications using the DisallowedRawHtml extension to process untrusted markdown are affected. Applications that use a dedicated HTML sanitizer (such as HTML Purifier) on the rendered output are not affected.

Patches

Fixed in 2.8.1. The regex character class [ \/>] was changed to [\s\/>] to match all whitespace characters that browsers accept as valid tag name terminators.

Workarounds

  • Set the html_input configuration option to 'escape' or 'strip' to disable all raw HTML, though this is a broader restriction than the DisallowedRawHtml extension provides.
  • Pass the rendered HTML through a dedicated HTML sanitizer before serving it to users (always recommended)

Resources


Release Notes

thephpleague/commonmark (league/commonmark)

v2.8.1

Compare Source

This is a security release to address an issue where DisallowedRawHtml can be bypassed, resulting in a possible cross-site scripting (XSS) vulnerability.

Fixed
  • Fixed DisallowedRawHtmlRenderer not blocking raw HTML tags with trailing ASCII whitespace (GHSA-4v6x-c7xx-hw9f)
  • Fixed PHP 8.5 deprecation (#​1107)

v2.8.0

Compare Source

Added
  • Added a new HighlightExtension for marking important text using == syntax (#​1100)
Fixed
  • Fixed AutolinkExtension incorrectly matching URLs after invalid www. prefix (#​1095, #​1103)

v2.7.1

Compare Source

Changed
  • Optimized several regular expressions in RegexHelper to improve performance (#​674, #​1086)
Fixed
  • EmbedProcessor no longer calls updateEmbeds() when there are no embeds to update (#​1081)
  • Fixed missing benchmark.php CSV path validation for non-existent files (#​1068, #​1085)

v2.7.0

Compare Source

This is a security release to address a potential cross-site scripting (XSS) vulnerability when using the AttributesExtension with untrusted user input.

Added
  • Added attributes/allow config option to specify which attributes users are allowed to set on elements (default allows virtually all attributes)
Changed
  • The AttributesExtension blocks all attributes starting with on unless explicitly allowed via the attributes/allow config option
  • The allow_unsafe_links option is now respected by the AttributesExtension when users specify href and src attributes

v2.6.2

Compare Source

Fixed
  • Fixed Attributes extension parsing regression (#​1071)

v2.6.1

Compare Source

Fixed
  • Rendered list items should only add newlines around block-level children (#​1059, #​1061)

v2.6.0

Compare Source

This is a security release to address potential denial of service attacks when parsing specially crafted,
malicious input from untrusted sources (like user input).

Added
  • Added max_delimiters_per_line config option to prevent denial of service attacks when parsing malicious input
  • Added table/max_autocompleted_cells config option to prevent denial of service attacks when parsing large tables
  • The AttributesExtension now supports attributes without values (#​985, #​986)
  • The AutolinkExtension exposes two new configuration options to override the default behavior (#​969, #​987):
    • autolink/allowed_protocols - an array of protocols to allow autolinking for
    • autolink/default_protocol - the default protocol to use when none is specified
  • Added RegexHelper::isWhitespace() method to check if a given character is an ASCII whitespace character
  • Added CacheableDelimiterProcessorInterface to ensure linear complexity for dynamic delimiter processing
  • Added Bracket delimiter type to optimize bracket parsing
Changed
  • [ and ] are no longer added as Delimiter objects on the stack; a new Bracket type with its own stack is used instead
  • UrlAutolinkParser no longer parses URLs with more than 127 subdomains
  • Expanded reference links can no longer exceed 100kb, or the size of the input document (whichever is greater)
  • Delimiters should always provide a non-null value via DelimiterInterface::getIndex()
    • We'll attempt to infer the index based on surrounding delimiters where possible
  • The DelimiterStack now accepts integer positions for any $stackBottom argument
  • Several small performance optimizations

v2.5.3

Compare Source

Changed
  • Made compatible with CommonMark spec 0.31.1, including:
    • Remove source, add search to list of recognized block tags

v2.5.2

Compare Source

Changed
  • Boolean attributes now require an explicit true value (#​1040)
Fixed
  • Fixed regression where text could be misinterpreted as an attribute (#​1040)

v2.5.1

Compare Source

Fixed
  • Fixed attribute parsing incorrectly parsing mustache-like syntax (#​1035)
  • Fixed incorrect Table start line numbers (#​1037)

v2.5.0

Compare Source

Added
  • The AttributesExtension now supports attributes without values (#​985, #​986)
  • The AutolinkExtension exposes two new configuration options to override the default behavior (#​969, #​987):
    • autolink/allowed_protocols - an array of protocols to allow autolinking for
    • autolink/default_protocol - the default protocol to use when none is specified
Changed
  • Made compatible with CommonMark spec 0.31.0, including:
    • Allow closing fence to be followed by tabs
    • Remove restrictive limitation on inline comments
    • Unicode symbols now treated like punctuation (for purposes of flankingness)
    • Trailing tabs on the last line of indented code blocks will be excluded
    • Improved HTML comment matching
  • Paragraphs only containing link reference definitions will be kept in the AST until the Document is finalized
    • (These were previously removed immediately after parsing the Paragraph)
Fixed
  • Fixed list tightness not being determined properly in some edge cases
  • Fixed incorrect ending line numbers for several block types in various scenarios
  • Fixed lowercase inline HTML declarations not being accepted

v2.4.4

Compare Source

Fixed
  • Fixed SmartPunct extension changing already-formatted quotation marks (#​1030)

v2.4.3

Compare Source

Fixed
  • Fixed the Attributes extension not supporting CSS level 3 selectors (#​1013)
  • Fixed UrlAutolinkParser incorrectly parsing text containing www anywhere before an autolink (#​1025)

Configuration

📅 Schedule: Branch creation - "" in timezone UTC, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

Read more information about the use of Renovate Bot within Laminas.

@renovate renovate bot force-pushed the renovate/packagist-league-commonmark-vulnerability branch from 07af949 to 3f57b4b Compare May 6, 2025 02:33
@renovate renovate bot changed the title Update dependency league/commonmark to ^2.6.0 [SECURITY] Update dependency league/commonmark to ^2.7.0 [SECURITY] May 6, 2025
@renovate renovate bot changed the base branch from master to staging September 15, 2025 00:54
@renovate renovate bot force-pushed the renovate/packagist-league-commonmark-vulnerability branch 2 times, most recently from ff1af75 to 0b70e64 Compare October 14, 2025 22:34
@renovate renovate bot force-pushed the renovate/packagist-league-commonmark-vulnerability branch from 0b70e64 to 7edd37c Compare December 15, 2025 17:27
| datasource | package           | from  | to    |
| ---------- | ----------------- | ----- | ----- |
| packagist  | league/commonmark | 2.4.2 | 2.8.1 |


Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate bot force-pushed the renovate/packagist-league-commonmark-vulnerability branch from 7edd37c to c38d80f Compare March 7, 2026 02:58
@renovate renovate bot changed the title Update dependency league/commonmark to ^2.7.0 [SECURITY] Update dependency league/commonmark to ^2.8.1 [SECURITY] Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants