GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.11] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) by hartwork · Pull Request #139529 · python/cpython

Conversation

@hartwork

@hartwork hartwork commented Oct 2, 2025 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Expose the XML Expat 2.7.2 mitigation APIs to disallow use of disproportional amounts of dynamic memory from within an Expat parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is, parsers created by xml.parsers.expat.ParserCreate(), as:

  • parser.SetAllocTrackerActivationThreshold(threshold), and
  • parser.SetAllocTrackerMaximumAmplification(max_factor).

(cherry picked from commit f04bea4)

CC @picnixz

  • Issue: Expose Expat XML attack protection APIs #90949

📚 Documentation preview 📚: https://cpython-previews--139529.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
picnixz and others added 4 commits October 3, 2025 01:30
@picnixz @hartwork
pythongh-90949: add Expat API to prevent XML deadly allocations (CVE-…
a295473
…2025-59375) (python#139234)

Expose the XML Expat 2.7.2 mitigation APIs to disallow use of
disproportional amounts of dynamic memory from within an Expat
parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetAllocTrackerActivationThreshold(threshold)`, and
- `parser.SetAllocTrackerMaximumAmplification(max_factor)`.

(cherry picked from commit f04bea4)
@picnixz @hartwork
pythongh-90949: amend pythonGH-139234 in prevision of future mitigati…
5680561
…on API (python#139366)

Fix some typos left in f04bea4,
and simplify some internal functions to ease maintenance of future
mitigation APIs.

(cherry picked from commit 68a1778)
@hartwork
Make use of macro _Py_ID possible to pyexpat
1531331
@hartwork
Add temporary workaround for issue 139400
d97e5e8
@bedevere-app bedevere-app Bot mentioned this pull request Oct 2, 2025
Expose Expat XML attack protection APIs #90949
Closed
@bedevere-app bedevere-app Bot added awaiting review topic-XML labels Oct 2, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Oct 2, 2025
gh-90949: add Expat API to prevent XML deadly allocations #139234
Merged
hartwork added 3 commits October 3, 2025 22:01
@hartwork
Revert introduction of stddef.h import
38f9c63
Idea by @picnixz
@hartwork
Merge remote-tracking branch 'upstream/3.11' into backport-f04bea4-3.11
cd7ce12
@hartwork
Drop workaround for 139400 as no-longer-needed
a6b0561
@picnixz

picnixz commented Oct 7, 2025

Copy link
Copy Markdown
Member

To have a good synchronization, we'll also delay 3.10 to 3.13 backports for their next release cycle (see #139359 (comment)).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz self-assigned this Oct 7, 2025
@ambv

ambv commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

I set DO-NOT-MERGE to avoid confusion. Unset that when you think we should be releasing this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ambv ambv added the DO-NOT-MERGE label Oct 8, 2025
@picnixz picnixz removed the DO-NOT-MERGE label Nov 2, 2025
@hartwork
Merge remote-tracking branch 'upstream/3.11' into backport-f04bea4-3.11
cdf58fd
picnixz
picnixz approved these changes Nov 8, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Nov 8, 2025
@picnixz picnixz assigned pablogsal Nov 8, 2025
@hartwork

hartwork commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

@pablogsal do you have a minute for this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hartwork

hartwork commented Nov 22, 2025

Copy link
Copy Markdown
Contributor Author

@pablogsal do you have a minute for this? 🙏

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal approved these changes Nov 25, 2025
View reviewed changes
@pablogsal
pablogsal merged commit 9bbb68a into python:3.11 Nov 25, 2025
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 25, 2025
@pablogsal

pablogsal commented Nov 25, 2025

Copy link
Copy Markdown
Member

Thanks a lot for the backport and thanks for the patience :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz approved these changes
@pablogsal pablogsal pablogsal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@picnixz picnixz

@pablogsal pablogsal

Labels

topic-XML

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@hartwork @picnixz @ambv @pablogsal
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.