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 — Expose Expat XML attack protection APIs · Issue #90949 · python/cpython

Expose Expat XML attack protection APIs #90949

New issue
Copy link
New issue
Copy link
Closed
Closed
Expose Expat XML attack protection APIs#90949
Copy link
Assignees
picnixz
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-XMLtype-featureA feature request or enhancementA feature request or enhancementtype-securityA security issueA security issue

Description

@gpshead
gpshead
opened on Feb 18, 2022
Issue body actions
BPO 46793
Nosy @gpshead, @hartwork, @corona10

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-02-18.21:27:31.809>
labels = ['type-feature', '3.11']
title = 'expose expat XML billion laughs attack mitigation APIs'
updated_at = <Date 2022-02-25.02:16:52.654>
user = 'https://github.com/gpshead'

bugs.python.org fields:

activity = <Date 2022-02-25.02:16:52.654>
actor = 'sping'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2022-02-18.21:27:31.809>
creator = 'gregory.p.smith'
dependencies = []
files = []
hgrepos = []
issue_num = 46793
keywords = []
message_count = 2.0
messages = ['413513', '413955']
nosy_count = 3.0
nosy_names = ['gregory.p.smith', 'sping', 'corona10']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue46793'
versions = ['Python 3.11']

Linked PRs

  • gh-90949: add Expat API to prevent XML deadly allocations #139234
  • gh-90949: amend GH-139234 in prevision of future mitigation API #139366
  • [3.14] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) #139359
  • [3.13] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) #139367
  • [3.12] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) #139527
  • [3.11] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) #139529
  • [3.10] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) #139532
  • gh-90949: expose Expat API to tune exponential expansion protections #139368
  • gh-90949: Fix an "unused function" compiler warning introduced in GH-139234 #139558
  • gh-90949: Recommend hasattr with Expat security methods #139800
  • [3.14] gh-90949: expose Expat API to tune exponential expansion protections (GH-139368) #150496
  • gh-90949: Fix copy-paste typo in pyexpat capsule API initialization #151147
  • [3.13] gh-90949: expose Expat API to tune exponential expansion protections (GH-139368) #151151
  • [3.12] gh-90949: expose Expat API to tune exponential expansion protections (GH-139368) #151401
  • [3.15] gh-90949: Fix copy-paste typo in pyexpat capsule API initialization (GH-151147) #152088
  • [3.11] gh-90949: expose Expat API to tune exponential expansion protections (GH-139368) (GH-151401) #155346
  • [3.10] gh-90949: expose Expat API to tune exponential expansion protections (GH-139368) (#151401) #155414

Activity

Next
  1. gpshead commented on Feb 18, 2022

    @gpshead
    gpshead
    on Feb 18, 2022
    MemberAuthor
    More actions

    Quoting from #31397 (comment)

    """
    XML_SetBillionLaughsAttackProtectionActivationThreshold

    XML_SetBillionLaughsAttackProtectionMaximumAmplification

    I still hope that someone can make those two^^ accessible (with additional glue code) to the user on pyexpat level in CPython.
    """ - Sebastian Pipping @hartwork

  2. gpshead
    added
    3.11only security fixesonly security fixes
    type-featureA feature request or enhancementA feature request or enhancement
    on Feb 18, 2022
  3. hartwork commented on Feb 25, 2022

    @hartwork
    hartworkmannequin
    on Feb 25, 2022
    Mannequin
    More actions

    First mention at https://bugs.python.org/issue44394#msg395642

  4. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  5. serhiy-storchaka
    added
    topic-XML
    on May 10, 2022
  6. hartwork commented on Sep 16, 2025

    @hartwork
    hartwork
    on Sep 16, 2025
    Contributor
    More actions

    FYI starting with Expat 2.7.2, there are two new API functions more related to both security and amplification:

    • XML_SetAllocTrackerActivationThreshold
    • XML_SetAllocTrackerMaximumAmplification
  7. gpshead
    removed
    3.11only security fixesonly security fixes
    on Sep 17, 2025
  8. picnixz
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    on Sep 17, 2025
  9. picnixz
    self-assigned this
    on Sep 17, 2025
  10. picnixz commented on Sep 17, 2025

    @picnixz
    picnixz
    on Sep 17, 2025
    Member
    More actions

    @hartwork I have a question on the API usage. It appears that we can only call those functions on parsers without parents. Do you suggest that we:

    • provide a module-wide function which, for any parser object created by the user, the function will be called automatically for orphan parsers, or
    • keep it a per-parser configuration?

    Having it enabled everywhere seems fine to me, considering that otherwise users would need to know whether a parser has a parent or not, however, there is no way to detect this on our side to warn them properly (the structure is opaque).

    I think the only way to get a parser with a parent is through XML_ExternalEntityParserCreate nbut I don't really know if I'm entirely right here.

    Reacted by Sebastian Pipping
  11. hartwork commented on Sep 17, 2025

    @hartwork
    hartwork
    on Sep 17, 2025
    Contributor
    More actions

    Hello @picnixz, thanks for your interest! 👍

    @hartwork I have a question on the API usage. It appears that we can only call those functions on parsers without parents.

    Yes. It's a deliberate choice to disallow that, the alternative would have been to instead find the root parser and apply the change to the root parser. The latter could be considered misleading or convenient, depending on view.

    Do you suggest that we:

    • provide a module-wide function which, for any parser object created by the user, the function will be called automatically for orphan parsers, or

    • keep it a per-parser configuration?

    Definitely not module wide — two unrelated parsers can have different limit and threshold values at runtime —, the rest I may not fully understand. Can you help me understand the rest better, e.g. the orphan part of it?

    Having it enabled everywhere seems fine to me, considering that otherwise users would need to know whether a parser has a parent or not, however, there is no way to detect this on our side to warn them properly (the structure is opaque).

    I think you're right that a parser cannot be asked "do you have a parent?" currently. "Not easily" for sure, "not at all" probably.

    I think the only way to get a parser with a parent is through XML_ExternalEntityParserCreate nbut I don't really know if I'm entirely right here.

    That is correct, it's the only way.

    I'm happy to discuss this more.

  12. picnixz commented on Sep 17, 2025

    @picnixz
    picnixz
    on Sep 17, 2025
    Member
    More actions

    By orphan I meant without a parent parser. What I wanted to know was whether we should, upon parser creation, call these new functions internally with thresholds and factors being set globally but you already answered by "no" so it's good on my side.

    Considering the failure can only happen when either the parser has a parent or the factor is invalid as a number, I'm going to simply remake those checks on Python's side so that I can raise appropriate exceptions (ideally I would have loved having a return code being returned by expat so that I know what exactly happened but it's also fine).

    Reacted by Sebastian Pipping
  13. 33 remaining items

  14. picnixz
    added a commit that references this issue on Nov 2, 2025

    [3.13] gh-90949: add Expat API to prevent XML deadly allocations (CVE…

    bc36bd1
  15. pablogsal
    added 2 commits that reference this issue on Nov 25, 2025

    [3.10] gh-90949: add Expat API to prevent XML deadly allocations (CVE…

    1173f80

    [3.11] gh-90949: add Expat API to prevent XML deadly allocations (CVE…

    9bbb68a
  16. Yhg1s
    added a commit that references this issue on Dec 17, 2025

    [3.12] gh-90949: add Expat API to prevent XML deadly allocations (CVE…

    0e4cd89
  17. StanFromIreland
    added a commit that references this issue on May 26, 2026

    [3.14] pythongh-90949: expose Expat API to tune exponential expansion…

    8615892
  18. StanFromIreland
    added 2 commits that reference this issue on Jun 9, 2026

    [3.14] gh-90949: expose Expat API to tune exponential expansion prote…

    c078637

    [3.13] gh-90949: expose Expat API to tune exponential expansion prote…

    19bc391
  19. StanFromIreland
    added 2 commits that reference this issue on Jun 24, 2026

    gh-90949: Fix copy-paste typo in pyexpat capsule API initialization (#…

    15696a6

    [3.15] gh-90949: Fix copy-paste typo in pyexpat capsule API initializ…

    d4836f4
  20. Yhg1s
    added a commit that references this issue on Aug 4, 2026

    [3.12] gh-90949: expose Expat API to tune exponential expansion prote…

    db195e3
  21. pablogsal
    added 2 commits that reference this issue on Aug 9, 2026

    [3.11] gh-90949: expose Expat API to tune exponential expansion prote…

    3c1801a

    [3.10] gh-90949: expose Expat API to tune exponential expansion prote…

    14c3f89
  22. StanFromIreland
    closed this as completedon Aug 10, 2026
  23. icanhasmath
    added 2 commits that reference this issue on Oct 28, 2026

    [3.10] pythongh-149018: Use `XML_SetHashSalt16Bytes` in `pyexpat`/`_e…

    7eda8df

    3.7.17.x: rename the newer Expat API symbols in pyexpatns.h

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

Metadata

Metadata

Assignees

  • @picnixz
    picnixz

Labels

extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-XMLtype-featureA feature request or enhancementA feature request or enhancementtype-securityA security issueA security issue

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.