fix: Add resource: protocol to allowed URL schemes by default#3795
fix: Add resource: protocol to allowed URL schemes by default#3795
resource: protocol to allowed URL schemes by default#3795Conversation
This update includes `resource:` in the list of allowed URL schemes for retrieving configuration files. See [`log4j2.configurationAllowedProtocols`](https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.configurationAllowedProtocols) Currently, the `resource:` protocol is used exclusively by a `URLStreamHandler` that retrieves files from the embedded resources in a GraalVM native image. This makes it a secure and appropriate source for trusted configuration files. This change cannot be easily and reliably tested through a unit test. An integration test will be provided in apache/logging-log4j-samples#345 Closes #3790
I have some concerns regarding this change:
Can we instead fix this in the upstream, i.e., Spring Boot itself? If we can, I understand that this will only apply to users using the latest and greatest Spring Boot – though we can detail this document and share the |
This change introduces an internal `SystemUtils.isGraalVm()` method to detect the presence of GraalVM and enable the `resource` protocol.
If an attacker has already gained the ability to place a malicious resource in the classpath, the system has already been compromised.
The That said, I understand your concerns about allowing a protocol whose semantics are not fully defined. In 0f1af39, I introduced a helper method, |
* fix: Add `resource:` protocol to allowed URL schemes by default This update includes `resource:` in the list of allowed URL schemes for retrieving configuration files. See [`log4j2.configurationAllowedProtocols`](https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.configurationAllowedProtocols) Currently, the `resource:` protocol is used exclusively by a `URLStreamHandler` that retrieves files from the embedded resources in a GraalVM native image. This makes it a secure and appropriate source for trusted configuration files. This change cannot be easily and reliably tested through a unit test. An integration test will be provided in apache/logging-log4j-samples#345 Closes #3790 * fix: Add `resource` protocol only in native images This change introduces an internal `SystemUtils.isGraalVm()` method to detect the presence of GraalVM and enable the `resource` protocol. * Reword changelog entry --------- Co-authored-by: Volkan Yazıcı <volkan@yazi.ci>
This update includes
resource:in the list of allowed URL schemes for retrieving configuration files. Seelog4j2.configurationAllowedProtocols.Currently, the
resource:protocol is used exclusively by aURLStreamHandlerthat retrieves files from the embedded resources in a GraalVM native image. This makes it a secure and appropriate source for trusted configuration files.This change cannot be easily and reliably tested through a unit test. An integration test will be provided in apache/logging-log4j-samples#345
Closes #3790