From 87d3f5215ad9420641cb188ae1d8f5011a257181 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Sun, 20 Sep 2020 20:17:42 -0400 Subject: [PATCH] caddyconfig: Error on extra args for route and handle directive family --- caddyconfig/httpcaddyfile/directives.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go index 9e17eeb3beb..e9ba44c8ed6 100644 --- a/caddyconfig/httpcaddyfile/directives.go +++ b/caddyconfig/httpcaddyfile/directives.go @@ -285,6 +285,11 @@ func parseSegmentAsConfig(h Helper) ([]ConfigValue, error) { var allResults []ConfigValue for h.Next() { + // don't allow non-matcher args on the first line + if h.NextArg() { + return nil, h.ArgErr() + } + // slice the linear list of tokens into top-level segments var segments []caddyfile.Segment for nesting := h.Nesting(); h.NextBlock(nesting); {