Update dependency lxml to v6 [SECURITY]#324
Open
renovate[bot] wants to merge 1 commit intodevelopfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==5.4.0→==6.1.0lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files
CVE-2026-41066 / GHSA-vfmq-68hx-4jfw
More information
Details
Impact
Using either of the two parsers in the default configuration (with
resolve_entities=True) allows untrusted XML input to read local files.Patches
lxml 6.1.0 changes the default to
resolve_entities='internal', thus disallowing local file access by default.Workarounds
Setting the
resolve_entitiesoption explicitly toresolve_entities='internal'orresolve_entities=Falsedisables the local file access.Resources
Original report: https://bugs.launchpad.net/lxml/+bug/2146291
The default option was changed to
resolve_entities='internal'for the normal XML and HTML parsers in lxml 5.0. The default was not changed foriterparse()andETCompatXMLParser()at the time. lxml 6.1 makes the safe option the default for all parsers.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
lxml: Default configuration of iterparse() and ETCompatXMLParser() allows XXE to local files
CVE-2026-41066 / GHSA-vfmq-68hx-4jfw
More information
Details
Impact
Using either of the two parsers in the default configuration (with
resolve_entities=True) allows untrusted XML input to read local files.Patches
lxml 6.1.0 changes the default to
resolve_entities='internal', thus disallowing local file access by default.Workarounds
Setting the
resolve_entitiesoption explicitly toresolve_entities='internal'orresolve_entities=Falsedisables the local file access.Resources
Original report: https://bugs.launchpad.net/lxml/+bug/2146291
The default option was changed to
resolve_entities='internal'for the normal XML and HTML parsers in lxml 5.0. The default was not changed foriterparse()andETCompatXMLParser()at the time. lxml 6.1 makes the safe option the default for all parsers.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
lxml/lxml (lxml)
v6.1.0Compare Source
==================
This release fixes a possible external entity injection (XXE) vulnerability in
iterparse()and theETCompatXMLParser.Features added
GH#486: The HTML ARIA accessibility attributes were added to the set of safe attributes
in
lxml.html.defs. This allowslxml_html_cleanto pass them through.Patch by oomsveta.
The default chunk size for reading from file-likes in
iterparse()is now configurablewith a new
chunk_sizeargument.Bugs fixed
resolve_entitiesoption was still set toTrueforiterparseandETCompatXMLParser, allowing for external entity injection (XXE)when using these parsers without setting this option explicitly.
The default was now changed to
'internal'only (as for the normal XML and HTML parserssince lxml 5.0).
Issue found by Sihao Qiu as CVE-2026-41066.
v6.0.4Compare Source
==================
Bugs fixed
v6.0.3Compare Source
==================
Bugs fixed
Several out of memory error cases now raise
MemoryErrorthat were not handled before.Slicing with large step values (outside of
+/- sys.maxsize) could trigger undefined C behaviour.LP#2125399: Some failing tests were fixed or disabled in PyPy.
LP#2138421: Memory leak in error cases when setting the
public_idorsystem_urlof a document.Memory leak in case of a memory allocation failure when copying document subtrees.
When mapping an XPath result to Python failed, the result memory could leak.
When preparing an XSLT transform failed, the XSLT parameter memory could leak.
Other changes
Built using Cython 3.2.4.
Binary wheels use zlib 1.3.2.
v6.0.2Compare Source
==================
Bugs fixed
LP#2125278: Compilation with libxml2 2.15.0 failed.
Original patch by Xi Ruoyao.
Setting
decompress=Truein the parser had no effect in libxml2 2.15.Binary wheels on Linux and macOS use the library version libxml2 2.14.6.
See https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.6
Test failures in libxml2 2.15.0 were fixed.
Other changes
Binary wheels for Py3.9-3.11 on the
riscv64architecture were added.Error constants were updated to match libxml2 2.15.0.
Built using Cython 3.1.4.
v6.0.1Compare Source
==================
Bugs fixed
LP#2116333:
lxml.sax._getNsTag()could fail with an exception on malformed input.GH#467: Some test adaptations were made for libxml2 2.15.
Patch by Nick Wellnhofer.
LP2119510, GH#473: A Python compatibility test was fixed for Python 3.14+.
Patch by Lumír Balhar.
GH#471: Wheels for "riscv64" on recent Python versions were added.
Patch by ffgan.
GH#469: The wheel build no longer requires the
wheelpackage unconditionally.Patch by Miro Hrončok.
Binary wheels use the library version libxml2 2.14.5.
See https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.14.5
Windows binary wheels continue to use a security patched library version libxml2 2.11.9.
v6.0.0Compare Source
==================
Features added
GH#463:
lxml.html.diffis faster and provides structurally better diffs.Original patch by Steven Fernandez.
GH#405: The factories
ElementandElementTreecan now be used in type hints.GH#448: Parsing from
memoryviewand other buffers is supported to allow zero-copy parsing.GH#437:
lxml.html.builderwas missing several HTML5 tag names.Patch by Nick Tarleton.
GH#458:
CDATAcan now be written into the incrementalxmlfile()writer.Original patch by Lane Shaw.
A new parser option
decompress=Falsewas added that controls the automaticinput decompression when using libxml2 2.15.0 or later. Disabling this option
by default will effectively prevent decompression bombs when handling untrusted
input. Code that depends on automatic decompression must enable this option.
Note that libxml2 2.15.0 was not released yet, so this option currently has no
effect but can already be used.
The set of compile time / runtime supported libxml2 feature names is available as
etree.LIBXML_COMPILED_FEATURESandetree.LIBXML_FEATURES.This currently includes
catalog,ftp,html,http,iconv,icu,lzma,regexp,schematron,xmlschema,xpath,zlib.Bugs fixed
GH#353: Predicates in
.find*()could mishandle tag indices if a default namespace is provided.Original patch by Luise K.
GH#272: The
headandbodyproperties oflxml.htmlelements failed if no such elementwas found. They now return
Noneinstead.Original patch by FVolral.
Tag names provided by code (API, not data) that are longer than
INT_MAXcould be truncated or mishandled in other ways.
.text_content()onlxml.htmlelements accidentally returned a "smart string"without additional information. It now returns a plain string.
LP#2109931: When building lxml with coverage reporting, it now disables the
sys.monitoringsupport due to the lack of support in nedbat/coveragepy#1790
Other changes
Support for Python < 3.8 was removed.
Parsing directly from zlib (or lzma) compressed data is now considered an optional
feature in lxml. It may get removed from libxml2 at some point for security reasons
(compression bombs) and is therefore no longer guaranteed to be available in lxml.
As of this release, zlib support is still normally available in the binary wheels
but may get disabled or removed in later (x.y.0) releases. To test the availability,
use
"zlib" in etree.LIBXML_FEATURES.The
Schematronclass is deprecated and will become non-functional in a future lxml version.The feature will soon be removed from libxml2 and stop being available.
GH#438: Wheels include the
arm7ltarget.GH#465: Windows wheels include the
arm64target.Patch by Finn Womack.
Binary wheels use the library versions libxml2 2.14.4 and libxslt 1.1.43.
Note that this disables direct HTTP and FTP support for parsing from URLs.
Use Python URL request tools instead (which usually also support HTTPS).
To test the availability, use
"http" in etree.LIBXML_FEATURES.Windows binary wheels use the library versions libxml2 2.11.9, libxslt 1.1.39 and libiconv 1.17.
They are now based on VS-2022.
Built using Cython 3.1.2.
The debug methods
MemDebug.dump()andMemDebug.show()were removed completely.libxml2 2.13.0 discarded this feature.
Configuration
📅 Schedule: (UTC)
🚦 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.
This PR was generated by Mend Renovate. View the repository job log.