Merge pull request #1453 from anoadragon453/anoa/fix_filepaths
Only raise security error on ../
This commit is contained in:
commit
9e7ae55068
2 changed files with 2 additions and 2 deletions
|
@ -362,7 +362,7 @@ class SiteStorage(object):
|
||||||
if not inner_path:
|
if not inner_path:
|
||||||
return self.directory
|
return self.directory
|
||||||
|
|
||||||
if ".." in inner_path:
|
if "../" in inner_path:
|
||||||
raise Exception(u"File not allowed: %s" % inner_path)
|
raise Exception(u"File not allowed: %s" % inner_path)
|
||||||
|
|
||||||
return u"%s/%s" % (self.directory, inner_path)
|
return u"%s/%s" % (self.directory, inner_path)
|
||||||
|
|
|
@ -526,7 +526,7 @@ class UiRequest(object):
|
||||||
if path.endswith("/"):
|
if path.endswith("/"):
|
||||||
path = path + "index.html"
|
path = path + "index.html"
|
||||||
|
|
||||||
if ".." in path or "./" in path:
|
if "../" in path or "./" in path:
|
||||||
raise SecurityError("Invalid path")
|
raise SecurityError("Invalid path")
|
||||||
|
|
||||||
match = re.match("/media/(?P<address>[A-Za-z0-9]+[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path)
|
match = re.match("/media/(?P<address>[A-Za-z0-9]+[A-Za-z0-9\._-]+)(?P<inner_path>/.*|$)", path)
|
||||||
|
|
Loading…
Reference in a new issue