-
Notifications
You must be signed in to change notification settings - Fork 98
Restrict environment keys for ImageMath.eval() #149
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
Conversation
Prevent environment keys matching the names of builtins and keys containing double underscores from being passed to ImageMath.eval(), by raising a ValueError. This is a cherry-pick of python-pillow#7655 to fix CVE-2023-50447 in Pillow-SIMD. Pillow only fixed it in 10.x, but Pillow-SIMD doesn't have that release yet so it's vulnerable. This commit solves that issue.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thanks for contribution, but it isn't the right place for it:
|
|
Hey @homm, the issue is already fixed in original Pillow, but until Pillow-SIMD upgrades to 10.2+ it will be vulnerable. We're waiting for Pillow-SIMD 10.2+ for quite a while now. Please reconsider this PR if the release won't happen soon to keep your users secured. |
|
First of all, I apologize for the misunderstanding. Unfortunately, my answer remains the same for several reasons. First, this involves a Pillow API change, and I aim to maintain 100% backward compatibility within the same versions. Second, I don’t see how this vulnerability can be exploited without writing Python code — and if you can write Python code, you don't need eval for that. Third, all Pillow versions have bugs that need patching for production use, so you'd likely install Pillow from a GitHub branch (as we do). You can apply this patch in your production branch if it really affects you. |
Prevent environment keys matching the names of builtins and keys containing double underscores from being passed to ImageMath.eval(), by raising a ValueError.
This is a cherry-pick of python-pillow#7655 to fix CVE-2023-50447 in Pillow-SIMD. Pillow only fixed it in 10.x, but Pillow-SIMD doesn't have that release yet so it's vulnerable. This commit solves that issue.