tweak regex filters

This commit is contained in:
Patrick Jones 2021-08-10 15:28:07 -07:00
parent 55a616b083
commit 844e38f109
1 changed files with 10 additions and 8 deletions

View File

@ -58,16 +58,18 @@ type Config struct {
var ( var (
validTokenURLPatterns = []*regexp.Regexp{ validTokenURLPatterns = []*regexp.Regexp{
regexp.MustCompile("https://[^\\.]+\\.sts\\.googleapis\\.com"), // The complicated part in the middle matches any number of characters that
regexp.MustCompile("https://sts\\.googleapis\\.com"), // aren't period, spaces, or slashes.
regexp.MustCompile("https://sts\\.[^\\.]+\\.googleapis\\.com"), regexp.MustCompile("^https://[^\\.\\s\\/\\\\]+\\.sts\\.googleapis\\.com"),
regexp.MustCompile("https://[^\\.]+-sts\\.googleapis\\.com"), regexp.MustCompile("^https://sts\\.googleapis\\.com"),
regexp.MustCompile("^https://sts\\.[^\\.\\s\\/\\\\]+\\.googleapis\\.com"),
regexp.MustCompile("^https://[^\\.\\s\\/\\\\]+-sts\\.googleapis\\.com"),
} }
validImpersonateURLPatterns = []*regexp.Regexp{ validImpersonateURLPatterns = []*regexp.Regexp{
regexp.MustCompile("https://[^\\.]+\\.iamcredentials\\.googleapis\\.com"), regexp.MustCompile("^https://[^\\.\\s\\/\\\\]+\\.iamcredentials\\.googleapis\\.com"),
regexp.MustCompile("https://iamcredentials\\.googleapis\\.com"), regexp.MustCompile("^https://iamcredentials\\.googleapis\\.com"),
regexp.MustCompile("https://iamcredentials\\.[^\\.]+\\.googleapis\\.com"), regexp.MustCompile("^https://iamcredentials\\.[^\\.\\s\\/\\\\]+\\.googleapis\\.com"),
regexp.MustCompile("https://[^\\.]+-iamcredentials\\.googleapis\\.com"), regexp.MustCompile("^https://[^\\.\\s\\/\\\\]+-iamcredentials\\.googleapis\\.com"),
} }
) )