ramanathan1504 commented on PR #4258:
URL: https://github.com/apache/logging-log4j2/pull/4258#issuecomment-6019558045

   > Hi @shaggyinsomniac,
   > 
   > Thank you for the PR, but the sanitization is **not** necessary, as you 
can see in the comment above the method:
   > 
   > 
https://github.com/apache/logging-log4j2/blob/d631e827ff0a14ec6c9db49c5e61d00709334dc4/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SmtpManager.java#L254-L256
   > 
   > What happens is that the Javadoc of `MimeMessage#setSubject` requires 
**callers** to santitize the value, but the code does it itself. Since all this 
code is in `jakarta.mail-api` and **unlikely** to change (for security 
reasons), we don't need to change anything.
   
   The new test passes with the source changes reverted, because `getSubject()` 
unfolds the header. Asserting on `getHeader("Subject", null)` keeps the CRLF 
without the fix, so that is the check to use.     
                                                                                
                                                                   
   @ppkarwasz the mail library already folds the value, so this is not a 
security fix. Do we still want the explicit escaping that the 
`MimeMessage#setSubject` Javadoc asks for, or should this be closed? 


-- 
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]

Reply via email to