vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

Key inner class in CookieStoreImpl has bug with subdomains

Open brr53 opened this issue 3 years ago • 0 comments

Which version(s) did you encounter this bug ? 4.3.4

Context

I noticed that CookieStoreImpl improperly parses the domain when there are subdomains.

The problem comes from the following lines: String[] tokens = domain.split("\\."); String tmp; for (int i = 0, j = tokens.length - 1; i < tokens.length / 2; ++i, --j) { tmp = tokens[j]; tokens[j] = tokens[i]; tokens[i] = tmp; } this.domain = String.join(".", tokens);

Do you have a reproducer?

new Key("test1.test2.ab.cd", "/", "name") //domain instance variable will be "cd.ab.test2.test1" (flipped)

  • Anything that can be relevant such as OS version, JVM version
  • Java 11
  • Windows 10

brr53 avatar Oct 04 '22 04:10 brr53