quantranhong1999 commented on code in PR #1824:
URL: https://github.com/apache/james-project/pull/1824#discussion_r1433939945


##########
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/HAProxyMessageHandler.java:
##########
@@ -60,6 +69,7 @@ public void channelRead(ChannelHandlerContext ctx, Object 
msg) throws Exception
                 // Refresh MDC info to account for proxying
                 MDCBuilder boundMDC = IMAPMDCContext.boundMDC(ctx);
 
+                connectionChecks.forEach(connectionCheck -> 
Mono.from(connectionCheck.validate((InetSocketAddress) 
ctx.channel().remoteAddress())).block());

Review Comment:
   IMO we should get the client IP from `HAProxyMessage`, not parsing again.
   
   Maybe `haproxyMsg.sourceAddress()` is the client IP instead? 
   
   TBH I am not sure. Please test more: at least try docker-compose with 
haproxy and try to see which one is the client IP. The current IMAPServerTest 
can not be fully trusted IMO.
   
   After being sure about the client IP, this work should be good IMO.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to