fix: reject unknown ready plugin properties (#8119)

Signed-off-by: immanuwell <pchpr.00@list.ru>
This commit is contained in:
Immanuel Tikhonov
2026-05-21 23:29:59 +04:00
committed by GitHub
parent 3e762bc603
commit 1fbc686758
2 changed files with 11 additions and 1 deletions

View File

@@ -90,7 +90,8 @@ func parse(c *caddy.Controller) (string, monitorType, error) {
} }
for c.NextBlock() { for c.NextBlock() {
if c.Val() == "monitor" { switch c.Val() {
case "monitor":
args := c.RemainingArgs() args := c.RemainingArgs()
if len(args) != 1 { if len(args) != 1 {
return "", "", c.ArgErr() return "", "", c.ArgErr()
@@ -101,6 +102,8 @@ func parse(c *caddy.Controller) (string, monitorType, error) {
if err != nil { if err != nil {
return "", "", err return "", "", err
} }
default:
return "", "", c.Errf("unknown property '%s'", c.Val())
} }
} }
} }

View File

@@ -58,6 +58,13 @@ ready localhost:1234 {
input: ` input: `
ready localhost:1234 { ready localhost:1234 {
monitor 404 monitor 404
}`,
shouldErr: true,
},
{
input: `
ready {
monitro continuously
}`, }`,
shouldErr: true, shouldErr: true,
}, },