]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39498 Start linking the security warnings in the stdlib modules (GH-18272) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Aug 2021 07:51:33 +0000 (00:51 -0700)
committerGitHub <noreply@github.com>
Tue, 10 Aug 2021 07:51:33 +0000 (09:51 +0200)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
(cherry picked from commit c5c5326d4799fe4ae566aff32ed3461af95859cc)

Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Doc/library/hashlib.rst
Doc/library/index.rst
Doc/library/logging.config.rst
Doc/library/multiprocessing.rst
Doc/library/security_warnings.rst [new file with mode: 0644]
Doc/library/shelve.rst
Doc/library/subprocess.rst
Doc/library/tempfile.rst
Doc/library/zipfile.rst
Misc/NEWS.d/next/Documentation/2020-01-30-05-18-48.bpo-39498.Nu3sFL.rst [new file with mode: 0644]

index 5a507c12d7f12f8c39622a3a1c49686e2d57b719..615ee116bbb0b9f78e6a73880adb7522bfa608c9 100644 (file)
@@ -80,6 +80,8 @@ library that Python uses on your platform. On most platforms the
 .. versionadded:: 3.6
    :func:`blake2b` and :func:`blake2s` were added.
 
+.. _hashlib-usedforsecurity:
+
 .. versionchanged:: 3.9
    All hashlib constructors take a keyword-only argument *usedforsecurity*
    with default value ``True``. A false value allows the use of insecure and
index 2cddb417da82e30c7e04a5f86969fe8e0c90f2e5..0fd6e4c0d0b0162fb7c03cd3042e16db54784f61 100644 (file)
@@ -76,3 +76,4 @@ the `Python Package Index <https://pypi.org>`_.
    unix.rst
    superseded.rst
    undoc.rst
+   security_warnings.rst
index 0b5e2fc2a658d5f04175d8ea04db2563b355f659..ab44850549c0cf102233df730232719409a714bf 100644 (file)
@@ -147,6 +147,8 @@ in :mod:`logging` itself) and defining handlers which are declared either in
    send it to the socket as a sequence of bytes preceded by a four-byte length
    string packed in binary using ``struct.pack('>L', n)``.
 
+   .. _logging-eval-security:
+
    .. note::
 
       Because portions of the configuration are passed through
index def27bf07a03e4e0fe69ca78bc827d89182d949f..952a5b40a0d1fd3dc062ac03f1ef279a7e5ce23b 100644 (file)
@@ -1187,6 +1187,7 @@ For example:
     >>> arr2
     array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])
 
+.. _multiprocessing-recv-pickle-security:
 
 .. warning::
 
diff --git a/Doc/library/security_warnings.rst b/Doc/library/security_warnings.rst
new file mode 100644 (file)
index 0000000..61fd4e6
--- /dev/null
@@ -0,0 +1,32 @@
+.. _security-warnings:
+
+.. index:: single: security considerations
+
+Security Considerations
+=======================
+
+The following modules have specific security considerations:
+
+* :mod:`cgi`: :ref:`CGI security considerations <cgi-security>`
+* :mod:`hashlib`: :ref:`all constructors take a "usedforsecurity" keyword-only
+  argument disabling known insecure and blocked algorithms
+  <hashlib-usedforsecurity>`
+* :mod:`http.server` is not suitable for production use, only implementing
+  basic security checks
+* :mod:`logging`: :ref:`Logging configuration uses eval()
+  <logging-eval-security>`
+* :mod:`multiprocessing`: :ref:`Connection.recv() uses pickle
+  <multiprocessing-recv-pickle-security>`
+* :mod:`pickle`: :ref:`Restricting globals in pickle <pickle-restrict>`
+* :mod:`random` shouldn't be used for security purposes, use :mod:`secrets`
+  instead
+* :mod:`shelve`: :ref:`shelve is based on pickle and thus unsuitable for
+  dealing with untrusted sources <shelve-security>`
+* :mod:`ssl`: :ref:`SSL/TLS security considerations <ssl-security>`
+* :mod:`subprocess`: :ref:`Subprocess security considerations
+  <subprocess-security>`
+* :mod:`tempfile`: :ref:`mktemp is deprecated due to vulnerability to race
+  conditions <tempfile-mktemp-deprecated>`
+* :mod:`xml`: :ref:`XML vulnerabilities <xml-vulnerabilities>`
+* :mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume
+  exhaustion <zipfile-resources-limitations>`
index 87bacb6c324421b2e2914e03e7396ed23aa7d4e4..98ad4082528615657f12d1bdb752dfffa44dc448 100644 (file)
@@ -49,6 +49,8 @@ lots of shared  sub-objects.  The keys are ordinary strings.
           with shelve.open('spam') as db:
               db['eggs'] = 'eggs'
 
+.. _shelve-security:
+
 .. warning::
 
    Because the :mod:`shelve` module is backed by :mod:`pickle`, it is insecure
index 2e9540ec48ce13db3efd6bd96d3d2f1d97f72374..57a3285f8f4d87e53b5d3b0a321e01683f9ec9fc 100644 (file)
@@ -683,6 +683,7 @@ Exceptions defined in this module all inherit from :exc:`SubprocessError`.
    .. versionadded:: 3.3
       The :exc:`SubprocessError` base class was added.
 
+.. _subprocess-security:
 
 Security Considerations
 -----------------------
index f9421da5fe7dfab84e3331fc8d9a4b0b8f186760..915489fadd401908241aa1f1e171326e6ed76c7b 100644 (file)
@@ -315,6 +315,7 @@ Here are some examples of typical usage of the :mod:`tempfile` module::
     >>>
     # directory and contents have been removed
 
+.. _tempfile-mktemp-deprecated:
 
 Deprecated functions and variables
 ----------------------------------
index d55a308be7651b91c9f5ccd125cb672d033f49fe..3d1e8d8c468dcf4af94d761c9d29c5ebbac49313 100644 (file)
@@ -848,6 +848,8 @@ Exceeding limitations on different file systems can cause decompression failed.
 Such as allowable characters in the directory entries, length of the file name,
 length of the pathname, size of a single file, and number of files, etc.
 
+.. _zipfile-resources-limitations:
+
 Resources limitations
 ~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/Misc/NEWS.d/next/Documentation/2020-01-30-05-18-48.bpo-39498.Nu3sFL.rst b/Misc/NEWS.d/next/Documentation/2020-01-30-05-18-48.bpo-39498.Nu3sFL.rst
new file mode 100644 (file)
index 0000000..a3e899a
--- /dev/null
@@ -0,0 +1 @@
+Add a "Security Considerations" index which links to standard library modules that have explicitly documented security considerations.