Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
daa82d01
Commit
daa82d01
authored
Aug 31, 2019
by
Daniel Pope
Committed by
Raymond Hettinger
Aug 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37977: Warn more strongly and clearly about pickle security (GH-15595)
parent
013e52fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
Doc/library/pickle.rst
Doc/library/pickle.rst
+18
-4
Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
...xt/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
+1
-0
No files found.
Doc/library/pickle.rst
View file @
daa82d01
...
...
@@ -30,9 +30,17 @@ avoid confusion, the terms used here are "pickling" and "unpickling".
.. warning::
The :mod:`pickle` module is not secure against erroneous or maliciously
constructed data. Never unpickle data received from an untrusted or
unauthenticated source.
The ``pickle`` module **is not secure**. Only unpickle data you trust.
It is possible to construct malicious pickle data which will **execute
arbitrary code during unpickling**. Never unpickle data that could have come
from an untrusted source, or that could have been tampered with.
Consider signing data with :mod:`hmac` if you need to ensure that it has not
been tampered with.
Safer serialization formats such as :mod:`json` may be more appropriate if
you are processing untrusted data. See :ref:`comparison-with-json`.
Relationship to other Python modules
...
...
@@ -75,6 +83,9 @@ The :mod:`pickle` module differs from :mod:`marshal` in several significant ways
pickling and unpickling code deals with Python 2 to Python 3 type differences
if your data is crossing that unique breaking change language boundary.
.. _comparison-with-json:
Comparison with ``json``
^^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -94,7 +105,10 @@ There are fundamental differences between the pickle protocols and
types, and no custom classes; pickle can represent an extremely large
number of Python types (many of them automatically, by clever usage
of Python's introspection facilities; complex cases can be tackled by
implementing :ref:`specific object APIs <pickle-inst>`).
implementing :ref:`specific object APIs <pickle-inst>`);
* Unlike pickle, deserializing untrusted JSON does not in itself create an
arbitrary code execution vulnerability.
.. seealso::
The :mod:`json` module: a standard library module allowing JSON
...
...
Misc/NEWS.d/next/Documentation/2019-08-29-14-38-01.bpo-37977.pML-UI.rst
0 → 100644
View file @
daa82d01
Warn more strongly and clearly about pickle insecurity
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment