From fe27f9cf0c7f53c891c35fbcf6a6b3219e85fd0a Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Mon, 21 Sep 2020 15:44:41 -0400 Subject: [PATCH] httpcaddyfile: Disallow args on route/handle directive family (#3740) --- caddyconfig/httpcaddyfile/directives.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go index 9e17eeb3..e9ba44c8 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); {