Skip to content

fix: sanitize uploaded filenames to prevent path traversal#488

Merged
husseinmozannar merged 2 commits intomainfrom
fix/path-traversal-upload
Feb 12, 2026
Merged

fix: sanitize uploaded filenames to prevent path traversal#488
husseinmozannar merged 2 commits intomainfrom
fix/path-traversal-upload

Conversation

@cheng-tan
Copy link
Copy Markdown
Collaborator

Strip directory components from user-supplied filenames using os.path.basename() before constructing the file path. This prevents an attacker from using ../../../ sequences to write files outside the intended run directory.

Strip directory components from user-supplied filenames using
os.path.basename() before constructing the file path. This prevents
an attacker from using ../../../ sequences to write files outside
the intended run directory.
@husseinmozannar husseinmozannar merged commit f705b0e into main Feb 12, 2026
9 checks passed
@husseinmozannar husseinmozannar deleted the fix/path-traversal-upload branch February 12, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants