Invalid IPv6 Address with X-Forwarded-For leads to number format exception #26748
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Affects: Spring Web 5.3.5
Hi Spring Team,
we run our Spring Boot Application using Spring Boot 2.4.4 which includes spring-web-5.3.5 in Google Cloud run.
Every IPv6 address that do not end with only numeric values lead to an internal server error due to a number format exception.
For example, this IPv6 address
2a02:918:175:ab60:45ee:c12c:dac1:808b
leads to a number format exception: as808b
is interpreted as the port. We know that the IPv6 address is invalid due to https://tools.ietf.org/html/rfc7239#section-6 and should be in the format of[2a02:918:175:ab60:45ee:c12c:dac1:808b]
. Therefore we also raised an issue at Google (https://issuetracker.google.com/issues/184230536).Regardless, I wanted to discuss whether better error handling would be useful here:
I would suggest to enforce the format described in RFC-7239 and if not, throw an exception describing the reason.
Kind Regards,
Florian
The text was updated successfully, but these errors were encountered: