Can the path returned by the ":path" convertor be trusted? #2585
Unanswered
pythonweb2
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Absolutely not. There's no protection whatsoever. It's just like a starlette/starlette/convertors.py Line 33 in 2d0dde8 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From a security standpoint, is the string returned from the ":path" converter safe to use? E.g. stripped of anything that would allow bad actors to access files they shouldn't?
Flask has this method for sanitizing user provided paths for example: https://werkzeug.palletsprojects.com/en/3.0.x/utils/#werkzeug.utils.secure_filename
I would assume it is, from some basic testing it seems to return 404 errors if a user tries to do some stuff with ".." in the path.
If so, it would be nice to call this out in the documentation to let users know that the string already has been sanitized.
Beta Was this translation helpful? Give feedback.
All reactions