Skip to content

Deprecate eval(), replacing it with lambda_eval() and unsafe_eval() #7927

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

Merged
merged 6 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added release notes and document deprecation
  • Loading branch information
radarhere authored and hugovk committed Apr 1, 2024
commit f6596d529399a80fb89daf2675987f1fd92cbd64
8 changes: 8 additions & 0 deletions docs/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ Deprecated Use instead
:py:data:`sys.version_info`, and ``PIL.__version__``
============================================ ====================================================

ImageMath eval()
^^^^^^^^^^^^^^^^

.. deprecated:: 10.3.0

``ImageMath.eval()`` has been deprecated. Use :py:meth:`~PIL.ImageMath.lambda_eval` or
:py:meth:`~PIL.ImageMath.unsafe_eval` instead.

Removed features
----------------

Expand Down
18 changes: 15 additions & 3 deletions docs/releasenotes/10.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
Security
========

TODO
^^^^
ImageMath eval()
^^^^^^^^^^^^^^^^

TODO
.. danger::
``ImageMath.eval()`` uses Python's ``eval()`` function to process the expression
string, and carries the security risks of doing so. A direct replacement for this is
the new :py:meth:`~PIL.ImageMath.unsafe_eval`, but that carries the same risks. It is
not recommended to process expressions without considering this.
:py:meth:`~PIL.ImageMath.lambda_eval` is a more secure alternative.

:cve:`YYYY-XXXXX`: TODO
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -58,6 +63,13 @@ Deprecated Use instead
:py:data:`sys.version_info`, and ``PIL.__version__``
============================================ ====================================================

ImageMath.eval()
^^^^^^^^^^^^^^^^

``ImageMath.eval()`` has been deprecated. Use :py:meth:`~PIL.ImageMath.lambda_eval` or
:py:meth:`~PIL.ImageMath.unsafe_eval` instead. See earlier security notes for more
information.

API Changes
===========

Expand Down