From 6736f5aebcaeff9cf696a02f3f5aa9758a314218 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 3 Apr 2019 08:52:29 +0200 Subject: [PATCH] gw api: require at least one group on runs query api --- internal/services/gateway/api/run.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/services/gateway/api/run.go b/internal/services/gateway/api/run.go index 0edbed9..c1fd3c2 100644 --- a/internal/services/gateway/api/run.go +++ b/internal/services/gateway/api/run.go @@ -299,8 +299,14 @@ func (h *RunsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { q := r.URL.Query() - phaseFilter := q["phase"] groups := q["group"] + // we require that groups are specified to not return all runs + if len(groups) == 0 { + http.Error(w, "not groups specified", http.StatusBadRequest) + return + } + + phaseFilter := q["phase"] changeGroups := q["changegroup"] _, lastRun := q["lastrun"]