From 449014058b8c5f08c864ab3f423331e39966cc35 Mon Sep 17 00:00:00 2001 From: vladvildanov Date: Thu, 28 Nov 2024 13:30:39 +0200 Subject: [PATCH 1/2] Fixed unsecured tempfile.mktemp() command usage --- tests/test_json.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_json.py b/tests/test_json.py index f4cea73787..2661111c04 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -1521,8 +1521,8 @@ def test_set_path(client): root = tempfile.mkdtemp() sub = tempfile.mkdtemp(dir=root) - jsonfile = tempfile.mktemp(suffix=".json", dir=sub) - nojsonfile = tempfile.mktemp(dir=root) + jsonfile = tempfile.mkstemp(suffix=".json", dir=sub) + nojsonfile = tempfile.mkstemp(dir=root) with open(jsonfile, "w+") as fp: fp.write(json.dumps({"hello": "world"})) From 61e7f08872fea5cbae0fb23699a99292e6b1e3e9 Mon Sep 17 00:00:00 2001 From: vladvildanov Date: Thu, 28 Nov 2024 13:42:25 +0200 Subject: [PATCH 2/2] Added proper tuple handling --- tests/test_json.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_json.py b/tests/test_json.py index 2661111c04..96009cd063 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -1521,8 +1521,8 @@ def test_set_path(client): root = tempfile.mkdtemp() sub = tempfile.mkdtemp(dir=root) - jsonfile = tempfile.mkstemp(suffix=".json", dir=sub) - nojsonfile = tempfile.mkstemp(dir=root) + jsonfile = tempfile.mkstemp(suffix=".json", dir=sub)[1] + nojsonfile = tempfile.mkstemp(dir=root)[1] with open(jsonfile, "w+") as fp: fp.write(json.dumps({"hello": "world"}))