-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
2.15.3 GA
-
False
-
-
False
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
Not Started
-
-
-
-
Critical
Current Behaviour
If the URL field is configured with redis://username:password@server:port/db the preflight checks are failing. It is unclear what is causing this currently but removing the whole username:password resolved the issue.
Expected Behaviour
The preflight checks should accept the same parameters and syntax as the redis client in system does. Therefore redis://username:password@server:port/db should be considered valid.
Important
It is clear from the code that a username is not accepted as part of the regex validation. I have validated that regexp:
^(?:redis://)?(?::([^@]+)@)?([^:/]+)(?::(\d+))?
and it fails to validate the aforementioned pattern but there seems to be a bug in the code because if that failed then the logic should log this error message but it does not.
Upon executing the snippet of code from redis_database_version_helper.go the following results are observed:
package main import ( "fmt" "regexp" ) func main() { var host string var port string var password string // user in URI ==> NG input := "redis://user:password@redis.example.com:6379/2" // omit user ==> OK // input := "redis://:password@redis.example.com:6379/2" pattern := `^(?:redis://)?(?::([^@]+)@)?([^:/]+)(?::(\d+))?` re := regexp.MustCompile(pattern) matches := re.FindStringSubmatch(input) fmt.Println("Matches found:", matches) if matches == nil { fmt.Println("Maches failed!") return } if len(matches) >= 3 { password = matches[1] host = matches[2] fmt.Println("Password: ", password) fmt.Println("host: ", host) } if len(matches) >= 4 { port = matches[3] fmt.Println("port:", port) } }
$ go run parse-redis.go
Matches found: [redis://user user ]
Password:
host: user
port:
When removing the username the logic executes correctly:
$ go run parse-redis.go
Matches found: [redis://:password@redis.example.com:6379 password redis.example.com 6379]
Password: password
host: redis.example.com
port: 6379
Thanks to rhn-support-hmiura for starting the investigation on this also.