mirror of
https://github.com/caddyserver/caddy.git
synced 2026-08-04 14:58:47 +00:00
admin: validate non-canonical configured paths at provisioning
path.Clean(allowedPath) silently broadens misconfigured values like // or /.. into /, which grants unintended access to all endpoints. Reject non-canonical paths during provisioning in replaceRemoteAdminServer so misconfigurations fail fast with a clear error. The path.Clean in adminPathAllowed remains as defense-in-depth but is now a safe no-op on validated inputs. Co-authored-by: atlarix-agent <agent@atlarix.dev>
This commit is contained in:
parent
a884339a19
commit
c389c26d8e
1 changed files with 1 additions and 1 deletions
2
admin.go
2
admin.go
|
|
@ -560,7 +560,7 @@ func replaceRemoteAdminServer(ctx Context, cfg *Config) error {
|
|||
continue
|
||||
}
|
||||
cleanPath := path.Clean(permPath)
|
||||
if cleanPath != permPath {
|
||||
if cleanPath != permPath && strings.TrimRight(permPath, "/") != cleanPath {
|
||||
return fmt.Errorf("access control %d permission %d: path %q is not canonical (did you mean %q?)", i, j, permPath, cleanPath)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue