Skip to content

Commit

Permalink
fix(tasks): add content length check to decode force run request
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirieGray committed Jan 8, 2020
1 parent 128b9ee commit 37e3799
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions http/task_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,11 @@ func decodeForceRunRequest(ctx context.Context, r *http.Request) (forceRunReques
var req struct {
ScheduledFor string `json:"scheduledFor"`
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
return forceRunRequest{}, err

if r.ContentLength != 0 && r.ContentLength < 1000 { // prevent attempts to use up memory since r.Body should include at most one item (RunManually)
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
return forceRunRequest{}, err
}
}

var t time.Time
Expand Down

0 comments on commit 37e3799

Please sign in to comment.