You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ra...@apache.org on 2026/09/17 07:29:47 UTC

(logging-log4j2) branch 2.x updated: Document location restrictions on Log4j 1 external entities (#4265)

This is an automated email from the ASF dual-hosted git repository.

ramanathan1504 pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 858d7ebf5e Document location restrictions on Log4j 1 external entities (#4265)
858d7ebf5e is described below

commit 858d7ebf5e1365e7adff76f13944e11363291c32
Author: Piotr P. Karwasz <pk...@apache.org>
AuthorDate: Thu Sep 17 09:29:33 2026 +0200

    Document location restrictions on Log4j 1 external entities (#4265)
    
    * docs: document location restrictions on Log4j 1 external entities
    
    Since version 2.27.0 (#4198), the external subset and other external
    entities in Log4j 1 XML configuration files are resolved through
    `ConfigurationSource`, so they can only be retrieved from locations
    allowed by the `log4j2.configurationAllowedProtocols` property.
    Document this in the migration guide and in the Javadoc of the bridge
    `XmlConfiguration`.
    
    Assisted-By: Claude Fable 5 <no...@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01LNsw2hhNuJ6tjsEU2tChnn
    
    * Apply batched suggestions from code review
    
    Co-authored-by: Ramanathan <ra...@gmail.com>
    
    ---------
    
    Co-authored-by: Ramanathan <ra...@gmail.com>
---
 .../src/main/java/org/apache/log4j/xml/XmlConfiguration.java       | 7 +++++++
 src/site/antora/modules/ROOT/pages/migrate-from-log4j1.adoc        | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java b/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
index aba6042c7a..a61f152a8f 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java
@@ -18,6 +18,7 @@ package org.apache.log4j.xml;
 
 import java.io.IOException;
 import java.io.InterruptedIOException;
+import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -77,6 +78,12 @@ import org.xml.sax.SAXParseException;
  *     Parsing and validation errors do not stop the configuration process; they are printed as warnings to the status
  *     logger.
  * </p>
+ * <p>
+ *     Since version <strong>2.27.0</strong>, external entities are resolved through
+ *     {@link ConfigurationSource#fromUri(URI)}, so they can only be retrieved from local files or over the protocols allowed by the
+ *     <a href="https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.configurationAllowedProtocols">{@code log4j2.configurationAllowedProtocols}</a>
+ *     configuration property.
+ * </p>
  */
 public class XmlConfiguration extends Log4j1Configuration {
 
diff --git a/src/site/antora/modules/ROOT/pages/migrate-from-log4j1.adoc b/src/site/antora/modules/ROOT/pages/migrate-from-log4j1.adoc
index a4434e1e70..13f3bf7c49 100644
--- a/src/site/antora/modules/ROOT/pages/migrate-from-log4j1.adoc
+++ b/src/site/antora/modules/ROOT/pages/migrate-from-log4j1.adoc
@@ -360,6 +360,13 @@ and
 xref:manual/configuration.adoc#configuration-attribute-schema[`schema`]
 attributes of the XML configuration format.
 
+[NOTE]
+====
+Since version `2.27.0`, the external subset and other external entities can only be retrieved from local files or over the protocols allowed by the
+xref:manual/systemproperties.adoc#log4j2.configurationAllowedProtocols[`log4j2.configurationAllowedProtocols`]
+property.
+====
+
 [#configuration-appenders]
 ==== Appenders