Skip to content

Commit

Permalink
bugfix, source path needs to be resolved before comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
opalmer committed Jan 3, 2015
1 parent bdae499 commit 16e56d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyfarm/master/api/tasklogs.py
Expand Up @@ -162,7 +162,7 @@ def post(self, job_id, task_id, attempt):
return jsonify(task_id=task_id, job_id=job_id,
error="Specified task not found"), NOT_FOUND

path = join(LOGFILES_DIR, g.json["identifier"])
path = realpath(join(LOGFILES_DIR, g.json["identifier"]))
if not realpath(path).startswith(LOGFILES_DIR):
return jsonify(error="Identifier is not acceptable"), BAD_REQUEST
task_log = TaskLog.query.filter_by(
Expand Down Expand Up @@ -294,7 +294,7 @@ def get(self, job_id, task_id, attempt, log_identifier):
return jsonify(task_id=task.id, log=log.identifier,
error="Specified log not found in task"), NOT_FOUND

path = join(LOGFILES_DIR, log_identifier)
path = realpath(join(LOGFILES_DIR, log_identifier))
if not realpath(path).startswith(LOGFILES_DIR):
return jsonify(error="Identifier is not acceptable"), BAD_REQUEST

Expand Down Expand Up @@ -354,7 +354,7 @@ def put(self, job_id, task_id, attempt, log_identifier):
return jsonify(task_id=task_id, log=log.identifier,
error="Specified log not found in task"), NOT_FOUND

path = join(LOGFILES_DIR, log_identifier)
path = realpath(join(LOGFILES_DIR, log_identifier))
if not realpath(path).startswith(LOGFILES_DIR):
return jsonify(error="Identifier is not acceptable"), BAD_REQUEST

Expand Down

0 comments on commit 16e56d3

Please sign in to comment.