Skip to content

Commit 6845e2a

Browse files
Fix code scanning alert no. 41: Uncontrolled data used in path expression (#2171)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent e9d46fd commit 6845e2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ def get_seed():
517517
file_name = hash
518518
else:
519519
return make_response(json.dumps({"error": "error"}), 205)
520-
fullpath = path.normpath(path.join("generated_seeds/", str(file_name) + ".json"))
521-
if not fullpath.startswith("generated_seeds/") and not fullpath.startswith("generated_seeds\\"):
520+
fullpath = path.realpath(path.join("generated_seeds/", str(file_name) + ".json"))
521+
if not fullpath.startswith(path.realpath("generated_seeds/")):
522522
raise Exception("not allowed")
523523
# Check if the file exists
524524
if path.isfile(fullpath):

0 commit comments

Comments
 (0)