-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Embedded Jetty throws null pointer exception #6076
Comments
@parmindersk there is something strange about your stacktrace and report. 246: String sniHost = (String)sslSession.getValue(SslContextFactory.Server.SNI_HOST);
247: X509 cert = new X509(null, (X509Certificate)sslSession.getLocalCertificates()[0]);
248: String serverName = request.getServerName(); So line 247 could throw a NPE if sslSession was null, but if that was the case then line 246 would have thrown. If Can you confirm what line 247 is in your version? @sbordet does |
@gregw These are my versions:
Regarding code, the lines are on the same lines that you mention. For now, I disabled the sniHostCheck and it has been working fine since then.
|
I've created PR #6078 to handle the only NPE I see possible there. The connection will still likely fail with, but with a 400 Bad Request response |
Fix #6076 Protect from null local certificates Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw I don't understand how it was possible to receive a request on a TLS connection whose server-side did not send a certificate to the client. I think your null check on the PR is unnecessary but a simple null check won't harm much. I think the problem reported in this issue is a different one however. @parmindersk can you reproduce the problem with full DEBUG logs enabled and attach the logs to this issue? |
Updates from review cache resulting X509 in session Signed-off-by: Greg Wilkins <gregw@webtide.com>
This could be cherry picked back to jetty-9 once it proves stable in jetty-10 |
9 already has NPE protection |
Jetty version
11.0.1
Java version
11
OS type/version
MacOX
Description
I'm using this code verbatim to run an embedded Jetty server.
HTTP calls work totally fine. However, HTTPS calls start failing after sometime with a null pointer exception
Debugging code I found that the host is null in this code block in Jetty's org.eclipse.jetty.server.SecureRequestCustomizer:
The text was updated successfully, but these errors were encountered: