Skip to content

Commit

Permalink
Merge branch 'main' into security-doc-fixes-3-2-product
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle-purcell authored Sep 12, 2023
2 parents 504e6c5 + 983f283 commit 4bd97f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void calculate() {

matcher = FORWARDED_FOR_PATTERN.matcher(forwarded);
if (matcher.find()) {
remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress.port());
remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress != null ? remoteAddress.port() : port);
}
} else if (forwardingProxyOptions.allowXForwarded) {
String protocolHeader = delegate.getHeader(X_FORWARDED_PROTO);
Expand Down Expand Up @@ -177,7 +177,7 @@ private void calculate() {

String forHeader = delegate.getHeader(X_FORWARDED_FOR);
if (forHeader != null) {
remoteAddress = parseFor(getFirstElement(forHeader), remoteAddress.port());
remoteAddress = parseFor(getFirstElement(forHeader), remoteAddress != null ? remoteAddress.port() : port);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4bd97f2

Please sign in to comment.