Skip to content

Commit

Permalink
ActionFile security check
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed May 11, 2017
1 parent 545459b commit 47245f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Ui/UiRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ def actionUiMedia(self, path):

# Stream a file to client
def actionFile(self, file_path, block_size=64 * 1024, send_header=True, header_length=True):
if ".." in file_path:
raise Exception("Invalid path")
if os.path.isfile(file_path):
# Try to figure out content type by extension
content_type = self.getContentType(file_path)
Expand Down Expand Up @@ -521,6 +523,7 @@ def actionConsole(self):
import sys
sites = self.server.sites
main = sys.modules["main"]

def bench(code, times=100):
sites = self.server.sites
main = sys.modules["main"]
Expand Down

0 comments on commit 47245f4

Please sign in to comment.