-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-118633: Add warning regarding the unsafe usage of eval and exec #118437
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
For more context, Liran Tal from Snyk posted the following on LinkedIn: https://snyk.io/de/blog/code-injection-vulnerabilities-caused-by-generative-ai/ So I opened this PR to discuss and improve the documentation concerning this matter. |
Should there also be some warning for |
FYI, There's already an entry in faq/programming. |
@Eclips4 thanks for the hint, but in my opinion this is not sufficient. Take a look at these: https://www.php.net/manual/en/function.eval.php I doubt that anyone reading a documentation entry knows, that there is a separate page with an important information. The warning should be directly in the documentation. |
Agree that Please add a warning to both |
I've added now the warning for |
LG for me. However there is one thing that I want to discuss: Do we need to add a similar note for the |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Thanks everyone for the PR, reviews and suggestions. I'm planning to merge. |
Thanks @DanielRuf for the PR, and @willingc for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…xec (pythonGH-118437) * Add warning regarding the unsafe usage of eval * Add warning regarding the unsafe usage of exec * Move warning under parameters table * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Improve wording as suggested --------- (cherry picked from commit 00e5ec0) Co-authored-by: Daniel Ruf <daniel@daniel-ruf.de> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Sorry, @DanielRuf and @willingc, I could not cleanly backport this to
|
GH-126161 is a backport of this pull request to the 3.13 branch. |
@willingc I can make the 3.12 backport if that would be helpful |
Thanks @brianschubert. Ping me if you run into any issues. |
…exec (GH-118437) (#126161) gh-118633: Add warning regarding the unsafe usage of eval and exec (GH-118437) * Add warning regarding the unsafe usage of eval * Add warning regarding the unsafe usage of exec * Move warning under parameters table * Use suggested shorter text * Use suggested shorter text * Improve wording as suggested --------- (cherry picked from commit 00e5ec0) Co-authored-by: Daniel Ruf <daniel@daniel-ruf.de> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…l and exec (pythonGH-118437) * Add warning regarding the unsafe usage of eval * Add warning regarding the unsafe usage of exec * Move warning under parameters table * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Improve wording as suggested --------- (cherry picked from commit 00e5ec0) Co-authored-by: Daniel Ruf <daniel@daniel-ruf.de> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
GH-126162 is a backport of this pull request to the 3.12 branch. |
…xec (pythonGH-118437) * Add warning regarding the unsafe usage of eval * Add warning regarding the unsafe usage of exec * Move warning under parameters table * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Improve wording as suggested --------- Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…xec (pythonGH-118437) * Add warning regarding the unsafe usage of eval * Add warning regarding the unsafe usage of exec * Move warning under parameters table * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Use suggested shorter text Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * Improve wording as suggested --------- Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
📚 Documentation preview 📚: https://cpython-previews--118437.org.readthedocs.build/