-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in Jersey Jetty handler's Host header parsing bubbles up to the top #5189
Milestone
Comments
jbescos
added a commit
to jbescos/jersey
that referenced
this issue
Nov 11, 2022
… the top eclipse-ee4j#5189 Signed-off-by: Jorge Bescos Gascon <[email protected]>
jbescos
added a commit
to jbescos/jersey
that referenced
this issue
Nov 11, 2022
… the top eclipse-ee4j#5189 Signed-off-by: Jorge Bescos Gascon <[email protected]>
jansupol
pushed a commit
that referenced
this issue
Nov 14, 2022
… the top #5189 Signed-off-by: Jorge Bescos Gascon <[email protected]>
This was referenced Dec 22, 2022
Closed
1 task
Closed
1 task
This was referenced Mar 16, 2023
Closed
1 task
This was referenced May 11, 2023
This was referenced Jun 1, 2023
This was referenced Jun 4, 2023
This was referenced Jun 15, 2023
This was referenced Jul 6, 2023
This was referenced Aug 28, 2023
This was referenced Jan 16, 2024
1 task
This was referenced Apr 13, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you deploy a Jersey + Jetty service to the big, bad public internet the service will inevitably start to receive requests with malicious or malformed
Host
(orX-Forwarded-Host
) headers. Instead of responding with HTTP 4XX errors, as would be expected, the Jersey internals will generate HTTP 500 errors.Note that
JettyHttpContainer.handle(...)
already contains a try/catch block whereURISyntaxException
seems to be handled correctly, butJettyHttpContainer.getBaseUri(...)
wraps itsURISyntaxException
in anIllegalArgumentException
-- unlikeJettyHttpContainer.getRequestUri(...)
, which throws it unmodified. My guess is thatJettyHttpContainer.getBaseUri(...)
just needs to be allowed to also throw itsURISyntaxException
unmodified, so that the try/catch inJettyHttpContainer.handle(...)
can handle it.Sample problematic
Host
header:Sample stack trace for the exception which is uncaught and triggers the HTTP 500 error response:
The text was updated successfully, but these errors were encountered: