Skip to content

Commit

Permalink
Validate the artifact client side as well
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Mar 19, 2016
1 parent a55b4fc commit 55509e9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion client/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,18 @@ func (r *TaskRunner) run() {
return
}

for _, artifact := range r.task.Artifacts {
for i, artifact := range r.task.Artifacts {
// Verify the artifact doesn't escape the task directory.
if err := artifact.Validate(); err != nil {
// If this error occurs there is potentially a server bug or
// mallicious, server spoofing.
r.setState(structs.TaskStateDead,
structs.NewTaskEvent(structs.TaskArtifactDownloadFailed).SetDownloadError(err))
r.logger.Printf("[ERR] client: allocation %q, task %v, artifact %v (%v) fails validation",
r.alloc.ID, r.task.Name, artifact, i)
return
}

if err := getter.GetArtifact(artifact, taskDir, r.logger); err != nil {
r.setState(structs.TaskStateDead,
structs.NewTaskEvent(structs.TaskArtifactDownloadFailed).SetDownloadError(err))
Expand Down

0 comments on commit 55509e9

Please sign in to comment.