Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 13:00 UTC
caddytls: Error if placeholder is empty in 'ask'
Fixes #5036
Matthew Holt committed
Sep 13, 2022 at 08:59 UTC
d35f618b10e9f530b068f42d1dcecb9e70b6ae0a
1 file changed
+5
-2
modules/caddytls/tls.go
+5
-2
@@ -185,9 +185,12 @@ func (t *TLS) Provision(ctx caddy.Context) error {
185
onDemandRateLimiter.SetWindow(0)
186
}
187
188
- // run replacer on ask URL (for environment variables)
188
+ // run replacer on ask URL (for environment variables) -- return errors to prevent surprises (#5036)
189
if t.Automation != nil && t.Automation.OnDemand != nil && t.Automation.OnDemand.Ask != "" {
190
- t.Automation.OnDemand.Ask = repl.ReplaceAll(t.Automation.OnDemand.Ask, "")
190
+ t.Automation.OnDemand.Ask, err = repl.ReplaceOrErr(t.Automation.OnDemand.Ask, true, true)
191
+ if err != nil {
192
+ return fmt.Errorf("preparing 'ask' endpoint: %v", err)
193
+ }
194
}
195
196
// load manual/static (unmanaged) certificates - we do this in