From 64869287fd8e5b6a14b4c68ce6f35625cda9f4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Mon, 11 Sep 2023 15:08:08 +0300 Subject: [PATCH] Add remote address NPE check (cherry picked from commit b7e4f0a43fe48292b06a67f45e7625ed9261a379) --- .../quarkus/vertx/http/runtime/ForwardedProxyHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedProxyHandler.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedProxyHandler.java index 6ba0cb9d1cc07..cde4f0d034fd8 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedProxyHandler.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedProxyHandler.java @@ -45,7 +45,11 @@ public ForwardedProxyHandler(TrustedProxyCheck.TrustedProxyCheckBuilder proxyChe @Override public void handle(HttpServerRequest event) { - if (event.remoteAddress().isDomainSocket()) { + if (event.remoteAddress() == null) { + // client address may not be available with virtual http channel + LOGGER.debug("Client address is not available, 'Forwarded' and 'X-Forwarded' headers are going to be ignored"); + handleForwardedServerRequest(event, denyAll()); + } else if (event.remoteAddress().isDomainSocket()) { // we do not support domain socket proxy checks, ignore the headers LOGGER.debug("Domain socket are not supported, 'Forwarded' and 'X-Forwarded' headers are going to be ignored"); handleForwardedServerRequest(event, denyAll());