abhiramaab opened a new pull request, #4431:
URL: https://github.com/apache/logging-log4j2/pull/4431

   ## Description
   
   `StatusLogger.PropertiesUtilsDouble#readAllAvailableProperties` directly 
called `System.getProperties()` and `System.getenv()` without handling 
`SecurityException`. When a `SecurityManager` denied access to system 
properties or environment variables, `StatusLogger` failed during static 
initialization, causing the Log4j API to crash on startup.
   
   ## Fix
   
   - Wrapped `System.getProperties()` in a `try-catch (SecurityException 
ignored)` block in `readSystemProperties()`, falling back to an empty 
`Properties` instance.
   - Wrapped `System.getenv()` in a `try-catch (SecurityException ignored)` 
block in `readEnvironmentProperties()`, falling back to an empty `Properties` 
instance.
   - Added the regression test 
`readAllAvailableProperties_should_not_fail_under_security_manager` in 
`StatusLoggerPropertiesUtilDoubleTest`.
   
   Closes #4429


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