From 3656fef69d44f819a3df958e9e81a47e3ab6a25a Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Mon, 26 Nov 2018 10:37:52 +0100 Subject: [PATCH] discard requests to /collect with missing requried query vars --- pkg/api/collect.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/api/collect.go b/pkg/api/collect.go index ffedd648..6bce2298 100644 --- a/pkg/api/collect.go +++ b/pkg/api/collect.go @@ -186,6 +186,15 @@ func shouldCollect(r *http.Request) bool { return false } + // discard if required query vars are missing + requiredQueryVars := []string{"id", "h", "p"} + q := r.URL.Query() + for _, k := range requiredQueryVars { + if q.Get(k) == "" { + return false + } + } + return true }