forked from orbit-oss/flask
Extra safety for safe_join. Does not look exploitable but better safe than sorry. Fixes #501
This commit is contained in:
parent
f701f69947
commit
3afcbf160e
2 changed files with 9 additions and 1 deletions
|
|
@ -604,7 +604,9 @@ def safe_join(directory, filename):
|
|||
for sep in _os_alt_seps:
|
||||
if sep in filename:
|
||||
raise NotFound()
|
||||
if os.path.isabs(filename) or filename.startswith('../'):
|
||||
if os.path.isabs(filename) or \
|
||||
filename == '..' or \
|
||||
filename.startswith('../'):
|
||||
raise NotFound()
|
||||
return os.path.join(directory, filename)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue