Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Update dependency league/commonmark to v2.6.0 [SECURITY] #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 9, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
league/commonmark (source) 2.3.5 -> 2.6.0 age adoption passing confidence

Warning

Some dependencies could not be looked up. Check the warning logs for more information.

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:


Release Notes

thephpleague/commonmark (league/commonmark)

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)

v2.4.2

Compare Source

Fixed
  • Fixed declaration parser being too strict
  • FencedCodeRenderer: don't add language- to class if already prefixed
Deprecated
  • Returning dynamic values from DelimiterProcessorInterface::getDelimiterUse() is deprecated
    • You should instead implement CacheableDelimiterProcessorInterface to help the engine perform caching to avoid performance issues.
  • Failing to set a delimiter's index (or returning null from DelimiterInterface::getIndex()) is deprecated and will not be supported in 3.0
  • Deprecated DelimiterInterface::isActive() and DelimiterInterface::setActive(), as these are no longer used by the engine
  • Deprecated DelimiterStack::removeEarlierMatches() and DelimiterStack::searchByCharacter(), as these are no longer used by the engine
  • Passing a DelimiterInterface as the $stackBottom argument to DelimiterStack::processDelimiters() or ::removeAll() is deprecated and will not be supported in 3.0; pass the integer position instead.
Fixed
  • Fixed NUL characters not being replaced in the input
  • Fixed quadratic complexity parsing unclosed inline links
  • Fixed quadratic complexity parsing emphasis and strikethrough delimiters
  • Fixed issue where having 500,000+ delimiters could trigger a known segmentation fault issue in PHP's garbage collection
  • Fixed quadratic complexity deactivating link openers
  • Fixed quadratic complexity parsing long backtick code spans with no matching closers
  • Fixed catastrophic backtracking when parsing link labels/titles

v2.4.1

Compare Source

Fixed
  • Fixed ExternalLinkProcessor not fully disabling the rel attribute when configured to do so (#​992)

v2.4.0

Compare Source

Added
  • Added generic CommonMarkException marker interface for all exceptions thrown by the library
  • Added several new specific exception types implementing that marker interface:
    • AlreadyInitializedException
    • InvalidArgumentException
    • IOException
    • LogicException
    • MissingDependencyException
    • NoMatchingRendererException
    • ParserLogicException
  • Added more configuration options to the Heading Permalinks extension (#​939):
    • heading_permalink/apply_id_to_heading - When true, the id attribute will be applied to the heading element itself instead of the <a> tag
    • heading_permalink/heading_class - class to apply to the heading element
    • heading_permalink/insert - now accepts none to prevent the creation of the <a> link
  • Added new table/alignment_attributes configuration option to control how table cell alignment is rendered (#​959)
Changed
  • Change several thrown exceptions from RuntimeException to LogicException (or something extending it), including:
    • CallbackGenerators that fail to set a URL or return an expected value
    • MarkdownParser when deactivating the last block parser or attempting to get an active block parser when they've all been closed
    • Adding items to an already-initialized Environment
    • Rendering a Node when no renderer has been registered for it
  • HeadingPermalinkProcessor now throws InvalidConfigurationException instead of RuntimeException when invalid config values are given.
  • HtmlElement::setAttribute() no longer requires the second parameter for boolean attributes
  • Several small micro-optimizations
  • Changed Strikethrough to only allow 1 or 2 tildes per the updated GFM spec
Fixed
  • Fixed inaccurate @throws docblocks throughout the codebase, including ConverterInterface, MarkdownConverter, and MarkdownConverterInterface.
    • These previously suggested that only \RuntimeExceptions were thrown, which was inaccurate as \LogicExceptions were also possible.

v2.3.9

Compare Source

Fixed
  • Fixed autolink extension not detecting some URIs with underscores (#​956)

v2.3.8

Compare Source

Fixed
  • Fixed parsing issues when mb_internal_encoding() is set to something other than UTF-8 (#​951)

v2.3.7

Compare Source

Fixed
  • Fixed TaskListItemMarkerRenderer not including HTML attributes set on the node by other extensions (#​947)

v2.3.6

Compare Source

Fixed
  • Fixed unquoted attribute parsing when closing curly brace is followed by certain characters (like a .) (#​943)

Configuration

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

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

Rebasing: Whenever PR becomes conflicted, 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

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title Update dependency league/commonmark to v2.6.0 [SECURITY] Update dependency league/commonmark to v2.6.0 [SECURITY] - autoclosed Dec 18, 2024
@renovate renovate bot closed this Dec 18, 2024
@renovate renovate bot deleted the renovate/packagist-league-commonmark-vulnerability branch December 18, 2024 08:45
@renovate renovate bot changed the title Update dependency league/commonmark to v2.6.0 [SECURITY] - autoclosed Update dependency league/commonmark to v2.6.0 [SECURITY] Dec 18, 2024
@renovate renovate bot reopened this Dec 18, 2024
@renovate renovate bot force-pushed the renovate/packagist-league-commonmark-vulnerability branch from 5883fb5 to da79a8a Compare December 18, 2024 09:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants