Skip to content

Commit 834a7e0

Browse files
committed
Doc/library/pyexpat.rst: Recommend "hasattr" with Expat security methods
This mimics existing method SetReparseDeferralEnabled.
1 parent d9cb191 commit 834a7e0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Doc/library/pyexpat.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ against some common XML vulnerabilities.
262262
Activation thresholds below 4 MiB are known to break support for DITA 1.3
263263
payload and are hence not recommended.
264264

265+
.. note::
266+
267+
:meth:`SetBillionLaughsAttackProtectionActivationThreshold`
268+
has been backported to some prior releases of CPython as a security fix.
269+
Check for availability of
270+
:meth:`SetBillionLaughsAttackProtectionActivationThreshold`
271+
using :func:`hasattr` if used in code running across a variety of Python
272+
versions.
273+
265274
.. versionadded:: next
266275

267276
.. method:: xmlparser.SetBillionLaughsAttackProtectionMaximumAmplification(max_factor, /)
@@ -294,6 +303,15 @@ against some common XML vulnerabilities.
294303
that can be adjusted by :meth:`.SetBillionLaughsAttackProtectionActivationThreshold`
295304
is exceeded.
296305

306+
.. note::
307+
308+
:meth:`SetBillionLaughsAttackProtectionMaximumAmplification`
309+
has been backported to some prior releases of CPython as a security fix.
310+
Check for availability of
311+
:meth:`SetBillionLaughsAttackProtectionMaximumAmplification`
312+
using :func:`hasattr` if used in code running across a variety of Python
313+
versions.
314+
297315
.. versionadded:: next
298316

299317
.. method:: xmlparser.SetAllocTrackerActivationThreshold(threshold, /)
@@ -309,6 +327,15 @@ against some common XML vulnerabilities.
309327
The corresponding :attr:`~ExpatError.lineno` and :attr:`~ExpatError.offset`
310328
should not be used as they may have no special meaning.
311329

330+
.. note::
331+
332+
:meth:`SetAllocTrackerActivationThreshold`
333+
has been backported to some prior releases of CPython as a security fix.
334+
Check for availability of
335+
:meth:`SetAllocTrackerActivationThreshold`
336+
using :func:`hasattr` if used in code running across a variety of Python
337+
versions.
338+
312339
.. versionadded:: next
313340

314341
.. method:: xmlparser.SetAllocTrackerMaximumAmplification(max_factor, /)
@@ -340,6 +367,15 @@ against some common XML vulnerabilities.
340367
that can be adjusted by :meth:`.SetAllocTrackerActivationThreshold`
341368
is exceeded.
342369

370+
.. note::
371+
372+
:meth:`SetAllocTrackerMaximumAmplification`
373+
has been backported to some prior releases of CPython as a security fix.
374+
Check for availability of
375+
:meth:`SetAllocTrackerMaximumAmplification`
376+
using :func:`hasattr` if used in code running across a variety of Python
377+
versions.
378+
343379
.. versionadded:: next
344380

345381

0 commit comments

Comments
 (0)