From 908475b94ce1d0c03340a8a975e4aa36b9ad16d2 Mon Sep 17 00:00:00 2001 From: clavedeluna Date: Mon, 4 Sep 2023 08:58:11 -0300 Subject: [PATCH] add tempfile py docs --- .../python/pixee_python_secure-tempfile.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/codemods/python/pixee_python_secure-tempfile.md diff --git a/docs/codemods/python/pixee_python_secure-tempfile.md b/docs/codemods/python/pixee_python_secure-tempfile.md new file mode 100644 index 0000000..434502b --- /dev/null +++ b/docs/codemods/python/pixee_python_secure-tempfile.md @@ -0,0 +1,34 @@ +--- +title: Make Secure Tempfiles +sidebar_position: 1 +--- + +## pixee:python/secure-tempfile + +| Importance | Review Guidance | Requires SARIF Tool | +|-----------|------------------------|---------------------| +| High | Merge Without Review | No | + +This codemod replaces all `tempfile.mktemp` calls to the more secure `tempfile.mkstemp`. + +The Python [tempfile documentation](https://docs.python.org/3/library/tempfile.html#tempfile.mktemp) is explicit +that `tempfile.mktemp` should be deprecated to avoid an unsafe and unexpected race condition. +The changes from this codemod look like this: + + +```diff + import tempfile +- tempfile.mktemp(...) ++ tempfile.mkstemp(...) +``` + +If you have feedback on this codemod, [please let us know](mailto:feedback@pixee.ai)! + +## F.A.Q. + +### Why is this codemod marked as Merge Without Review? + +We believe this codemod is safe and will cause no unexpected errors. + +## References +* [https://docs.python.org/3/library/tempfile.html#tempfile.mktemp](https://docs.python.org/3/library/tempfile.html#tempfile.mktemp)