mirror of
https://github.com/traefik/traefik.git
synced 2026-05-28 04:35:59 -04:00
Fix allow colons and tildes in api.basePath validation
This commit is contained in:
parent
30d5258c75
commit
25ab6f46d0
2 changed files with 11 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ const (
|
|||
)
|
||||
|
||||
// Allowed characters in URL following RFC 3986 (https://www.rfc-editor.org/rfc/rfc3986#section-2)
|
||||
var validBasePath = regexp.MustCompile(`^/[a-zA-Z0-9/_.-]*$`)
|
||||
var validBasePath = regexp.MustCompile(`^/[a-zA-Z0-9/_.:~-]*$`)
|
||||
|
||||
// Configuration is the static configuration.
|
||||
type Configuration struct {
|
||||
|
|
|
|||
|
|
@ -349,6 +349,16 @@ func TestValidateConfiguration_BasePath(t *testing.T) {
|
|||
basePath: "/api%2Ftoto",
|
||||
expectErr: true,
|
||||
},
|
||||
{
|
||||
desc: "valid path with colons",
|
||||
basePath: "/k8s/clusters/c-abcd0/api/v1/namespaces/my-ns/services/http:traefik:8080/proxy",
|
||||
expectErr: false,
|
||||
},
|
||||
{
|
||||
desc: "valid path with tilde",
|
||||
basePath: "/~user/dashboard",
|
||||
expectErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
|
|
|||
Loading…
Reference in a new issue