CVE-2023-50447: Restricted env keys for ImageMath.eval()#38
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports upstream fix for CVE-2023-50447 (arbitrary code execution via builtins/dunder keys in
ImageMath.evalenv).Source
45c726fd4daa63236a8f3653530f297dc87b160a— Don't allow__or builtins in env dictionaries for ImageMath.eval0ca3c33c59927e1c7e0c14dbc1eea1dfb2431a80— Allow ops557ba59d13de919d04b3fd4cdef8634f7d4b3348— Include further builtinsChanges
ImageMath.evalnow raisesValueErrorwhen a user-supplied env key contains__or matches a name on thebuiltinsmodule._dictandkwkeys (notops).test_prevent_double_underscoresandtest_prevent_builtinsinTests/test_imagemath.py.docs/releasenotes/9.5.0.1.rst(upstream's 10.2.0.rst update was dropped — not applicable to 9.5.x).Test plan
pytest Tests/test_imagemath.py