From 9118b3f3d8a2b62258e68bbf1c904fbc0ee58b61 Mon Sep 17 00:00:00 2001 From: Ishan Chattopadhyaya Date: Mon, 6 Nov 2023 22:28:07 +0530 Subject: [PATCH] SOLR-16781: directive disabled by default --- solr/CHANGES.txt | 9 ++++ .../java/org/apache/solr/core/SolrConfig.java | 6 +++ .../configsets/_default/conf/solrconfig.xml | 45 ------------------- solr/solr-ref-guide/src/configsets-api.adoc | 2 +- solr/solr-ref-guide/src/libs.adoc | 5 +++ 5 files changed, 21 insertions(+), 46 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index e71c21e322e..73c17993a6b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -8,11 +8,20 @@ https://github.com/apache/solr/blob/main/solr/solr-ref-guide/src/solr-upgrade-no Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. +Upgrade Notes +--------------------- + +* If your configset contains solrconfig.xml which uses tags, you either need to remove them (and place your jar files + in the standard classpath instead) or use -Dsolr.lib.directive.allowed=true start up parameter for your Solr nodes. This is a + security measure to protect against RCE attacks. More details are in SOLR-16781. + New Features --------------------- * SOLR-15694, 15715: Node roles and dedicated query coordinator nodes (Hitesh Khamesra, Ishan Chattopadhyaya, noble) +* SOLR-16781: Disable directives in solrconfig.xml by default (Ishan Chattopadhyaya) + Bug Fixes --------------------- * SOLR-16429: Add AWS STS support in s3-repository (Josh Souza via Houston Putman and Kevin Risden) diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.java index dfe8313f725..8806bd5b431 100644 --- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java +++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java @@ -843,8 +843,14 @@ private void initLibs(SolrResourceLoader loader, boolean isConfigsetTrusted) { } } + boolean libDirectiveAllowed = Boolean.getBoolean(System.getProperty("solr.lib.directive.allowed", "false")); List nodes = root.getAll("lib"); if (nodes != null && nodes.size() > 0) { + if (!libDirectiveAllowed) { + throw new SolrException(ErrorCode.UNAUTHORIZED, + " directive is not allowed to be used in a configset unless the Solr node is started with " + + "'-Dsolr.lib.directive.allowed=true'. Please remove the from your solrconfig.xml and try again."); + } if (!isConfigsetTrusted) { throw new SolrException(ErrorCode.UNAUTHORIZED, "The configset for this collection was uploaded without any authentication in place," diff --git a/solr/server/solr/configsets/_default/conf/solrconfig.xml b/solr/server/solr/configsets/_default/conf/solrconfig.xml index 762d4e67122..cf2430567ff 100644 --- a/solr/server/solr/configsets/_default/conf/solrconfig.xml +++ b/solr/server/solr/configsets/_default/conf/solrconfig.xml @@ -37,51 +37,6 @@ --> 8.11.3 - - - - - - - -