Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flask_webgoat/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess

from flask import Blueprint, request, jsonify, session
from werkzeug.utils import secure_filename

bp = Blueprint("actions", __name__)

Expand All @@ -29,10 +30,9 @@ def log_entry():
if not user_dir_path.exists():
user_dir_path.mkdir()

filename = filename_param + ".txt"
path = Path(user_dir + "/" + filename)
filename = secure_filename(filename_param) + ".txt"
path = Path(user_dir) / filename
with path.open("w", encoding="utf-8") as open_file:
# vulnerability: Directory Traversal
open_file.write(text_param)
return jsonify({"success": True})

Expand Down
Loading