Sanitize upload filename — path traversal in import route #3
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: critical
Category: security
Location:
app.py:436Problem
upload_path = os.path.join(DATA_DIR, file.filename)uses the raw browser filename. A name like../transactions.jsonoverwrites arbitrary files / clobbers the main data file.Suggested fix
Use
werkzeug.utils.secure_filename()and save into a dedicateduploads/subdir, separate from the JSON data files.Filed by automated code review.