]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39498 Start linking the security warnings in the stdlib modules (GH-18272)
authorAnthony Shaw <anthony.p.shaw@gmail.com>
Mon, 9 Aug 2021 22:35:51 +0000 (08:35 +1000)
committerGitHub <noreply@github.com>
Mon, 9 Aug 2021 22:35:51 +0000 (00:35 +0200)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
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 d22efa23015c6cb7d03deda5dd01174d83bd197d..37addee6cda809c9aad83d77b06cc9a473d071f8 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 1a9e52ec5ccfba331d6d65588584456737f388fc..db8f0d9bdfb8fbbadca1884a7d804edbe827bd34 100644 (file)
@@ -75,3 +75,4 @@ the `Python Package Index <https://pypi.org>`_.
    unix.rst
    superseded.rst
    undoc.rst
+   security_warnings.rst
index f833bcdd1fcf5b7e74870ec4e2c2a4f332ca5022..d3478a94345f0ac5a9135f4dbdd9848d99012866 100644 (file)
@@ -152,6 +152,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 b9396c3c7531cbc0e3ea42ffcde7227861756e15..c9b2a3716ff327b60b4edceff454e397b5b8543a 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 1031888a5889b79bb19f710861f6a1d63b17f21a..684f239ef06fa8e35b4c3a68e5cac06a3ecbaab2 100644 (file)
@@ -54,6 +54,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 a95047433d240e1eddecce7b9a97c699e4d4af9a..af5463364c44b592a340b779a749a2ec44b72334 100644 (file)
@@ -710,6 +710,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 49396b5f4bdc4d0ec07f589a2cf5db0a5a54494d..3e904d04642d80cbbbd91fb5280bd6db0a83b8ed 100644 (file)
@@ -344,6 +344,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 a0bbdbf595aa8cd5208cc3e974886a1bf476ae0b..9d0d894c05b57894254f4cc44e4338d6c4617f6c 100644 (file)
@@ -886,6 +886,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.