-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) #115623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 35 commits
7cebe78
c70fbae
dfca819
4baab67
7928942
e5e4033
bc6e1a7
b737f03
850e46d
7002024
2132dfe
3d02dfe
fdd2fac
dbbd98c
3b6ea39
5c1cfb7
a9c666e
35099e3
1496e83
a6927ff
c5b2159
082bcc1
f0577e7
f589908
4915045
d0ed243
62e4fd7
b0058d5
1f70c09
a77de0f
2f07457
4b49de9
3c960a6
4855bb9
b6a84b2
0faa19e
40743a6
a473299
a6baa0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,6 +196,37 @@ XMLParser Objects | |
| :exc:`ExpatError` to be raised with the :attr:`code` attribute set to | ||
| ``errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]``. | ||
|
|
||
| .. method:: xmlparser.SetReparseDeferralEnabled(enabled) | ||
|
|
||
| .. warning:: | ||
|
|
||
| Calling ``SetReparseDeferralEnabled(False)`` has security implications, | ||
| as detailed below; please make sure to understand these consequences | ||
| prior to using the ``SetReparseDeferralEnabled`` method. | ||
|
||
|
|
||
| Expat 2.6.0 introduced a security mechanism called "reparse deferral" | ||
| where instead of causing denial of service through quadratic runtime | ||
| from reparsing large tokens, reparsing of unfinished tokens is now delayed | ||
| by default until a sufficient amount of input is reached. | ||
| Due to this delay, registered handlers may — depending of the sizing of | ||
| input chunks pushed to Expat — no longer be called right after pushing new | ||
| input to the parser. Where immediate feedback and taking over responsiblity | ||
| of protecting against denial of service from large tokens are both wanted, | ||
| calling ``SetReparseDeferralEnabled(False)`` disables reparse deferral | ||
| for the current Expat parser instance, temporarily or altogether. | ||
| Calling ``SetReparseDeferralEnabled(True)`` allows re-enabling reparse | ||
| deferral. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @serhiy-storchaka I already had that on the radar for later today, will do. I'm unsure how 3.12 should be special here, I'd assume we start out with 3.13 and then adjust during backports for all other 3.x branches. Could you help me understand how 3.12.3 would help over 3.13 when targeting
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @serhiy-storchaka PS: 4x
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feature will be supported in the continuous interval "3.12.3-" of Python releases. If the user sees It may be only my personal opinion, but I think that this variant is better. But 3.13 is a good start, and we can discuss this later. |
||
| .. versionadded:: 3.13 | ||
|
|
||
| .. method:: xmlparser.GetReparseDeferralEnabled() | ||
|
|
||
| Returns whether reparse deferral is currently enabled for the given | ||
| Expat parser instance. | ||
|
|
||
| .. versionadded:: 3.13 | ||
|
|
||
|
|
||
| :class:`xmlparser` objects have the following attributes: | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.