Skip to content

Commit

Permalink
Update keep_alive.py
Browse files Browse the repository at this point in the history
Fixed File Path issue
  • Loading branch information
JaWarrior12 authored May 9, 2024
1 parent d84f5ec commit 8a1b1d2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions keep_alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ def home():
@app.route('/datafiles/<string:file>/<string:passkey>')
def jsondat(file,passkey=0):
if passkey=="1498657841136236":
return loads(open(f'{file}.json', 'r').read())
base_path = '/Backups'
#GOOD -- Verify with normalised version of path
fullpath = os.path.normpath(os.path.join(base_path, filename))
if not fullpath.startswith(base_path):
raise Exception("not allowed")
data = loads(open(fullpath, 'rb').read())
return data
#return loads(open(f'{file}.json', 'r').read())
else:
return "Access to NEW LIGHT DATA FILES is restricted."

Expand Down Expand Up @@ -83,4 +90,4 @@ def keep_alives():
Creates and starts new thread that runs the function run.
'''
t = Thread(target=run)
t.start()
t.start()

0 comments on commit 8a1b1d2

Please sign in to comment.