CUSTESC-23757: Fix a bug where a wildcard ingress rule would match an host without starting with a dot

This commit is contained in:
João Oliveirinha
2022-11-25 16:29:34 +00:00
parent b0663dce33
commit e3d35570e6
2 changed files with 11 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ func matchHost(ruleHost, reqHost string) bool {
// Validate hostnames that use wildcards at the start
if strings.HasPrefix(ruleHost, "*.") {
toMatch := strings.TrimPrefix(ruleHost, "*.")
toMatch := strings.TrimPrefix(ruleHost, "*")
return strings.HasSuffix(reqHost, toMatch)
}
return false