Validate path types (#9967)

* Validate path types

* Fix the year of header

* Update internal/ingress/controller/config/config.go

Co-authored-by: Jintao Zhang <tao12345666333@163.com>

---------

Co-authored-by: Jintao Zhang <tao12345666333@163.com>
This commit is contained in:
Ricardo Katz 2023-05-20 08:58:18 -03:00 committed by GitHub
parent 0dd1cf7460
commit c540b58474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 296 additions and 0 deletions

View file

@ -28,6 +28,14 @@ var (
invalidSecretsDir = regexp.MustCompile(`/var/run/secrets`)
invalidByLuaDirective = regexp.MustCompile(`.*_by_lua.*`)
// validPathType enforces alphanumeric, -, _ and / characters.
// The field (?i) turns this regex case insensitive
// The remaining regex says that the string must start with a "/" (^/)
// the group [[:alnum:]\_\-\/]* says that any amount of characters (A-Za-z0-9), _, - and /
// are accepted until the end of the line
// Nothing else is accepted.
validPathType = regexp.MustCompile(`(?i)^/[[:alnum:]\_\-\/]*$`)
invalidRegex = []regexp.Regexp{}
)