From eb9864721fed029a78c8a66c51637ab1a7aaa859 Mon Sep 17 00:00:00 2001 From: Christos Malliaridis Date: Wed, 27 Nov 2024 17:41:35 +0200 Subject: [PATCH 1/3] Remove unsupported / deprecated options for auth command (#2858) Co-authored-by: Eric Pugh --- solr/bin/solr.cmd | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index 9f875926517..ffa6f960daa 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -1174,11 +1174,9 @@ for %%a in (%*) do ( if "!arg:~0,1!" equ "-" set "option=!arg!" ) else ( set "option!option!=%%a" - if "!option!" equ "-s" set "SOLR_HOME=%%a" if "!option!" equ "--solr-home" set "SOLR_HOME=%%a" - if "!option!" equ "-d" set "SOLR_SERVER_DIR=%%a" - if "!option!" equ "--server-dir" set "SOLR_SERVER_DIR=%%a" - if not "!option!" equ "-s" if not "!option!" equ "--solr-home" if not "!option!" equ "-d" if not "!option!" equ "--server-dir" ( + if "!option!" equ "--server-dir" set "SOLR_SERVER_DIR=%%a" + if not "!option!" equ "--solr-home" if not "!option!" equ "--server-dir" ( set "AUTH_PARAMS=!AUTH_PARAMS! !option! %%a" ) set "option=" From 64130ec400a17fd95298dea1f54987f1be63d414 Mon Sep 17 00:00:00 2001 From: Jasmin Johal Date: Thu, 28 Nov 2024 00:55:01 -0800 Subject: [PATCH 2/3] Ref-guide - JWT: Use correct claim name in example config comments (#2890) --- .../deployment-guide/pages/jwt-authentication-plugin.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc index aec5f269d24..4a5094f6225 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc @@ -169,7 +169,7 @@ Let's comment on this config: <1> Plugin class <2> Make sure to block anyone without a valid token (this is also the default) <3> Fetch the user id from another claim than the default `sub` -<4> Require that the `roles` claim is one of "A" or "B" and that the `dept` claim is "IT" +<4> Require that the `foo` claim is one of "A" or "B" and that the `dept` claim is "IT" <5> Require one of the scopes `solr:read`, `solr:write` or `solr:admin` <6> Only accept RSA algorithms for signatures <7> Array of issuer configurations From cebdb2d790a656b949e0f1fcb6893333c63602e1 Mon Sep 17 00:00:00 2001 From: Alexander Zagniotov Date: Thu, 28 Nov 2024 01:01:45 -0800 Subject: [PATCH 3/3] SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid (#2886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Zagniotov Co-authored-by: Jan Høydahl --- solr/CHANGES.txt | 2 ++ .../LanguageIdentifierUpdateProcessor.java | 13 +++++----- ...ntifierUpdateProcessorFactoryTestCase.java | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 840de727b00..e32f1f1ac4f 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -227,6 +227,8 @@ Bug Fixes * SOLR-16976: Remove log4j-jul jar and use slf4j bridge for JUL to prevent exception from being logged when remote JMX is enabled (Shawn Heisey, Stephen Zhou, Eric Pugh, Christine Poerschke, David Smiley) +* SOLR-17575: Fixed broken backwards compatibility with the legacy "langid.whitelist" config in Solr Langid. (Jan Høydahl, Alexander Zagniotov) + Dependency Upgrades --------------------- (No changes) diff --git a/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java b/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java index 21921440cae..f4f1b9cc83c 100644 --- a/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java +++ b/solr/modules/langid/src/java/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessor.java @@ -111,8 +111,8 @@ private void initParams(SolrParams params) { overwrite = params.getBool(OVERWRITE, false); langAllowlist = new HashSet<>(); threshold = params.getDouble(THRESHOLD, DOCID_THRESHOLD_DEFAULT); - String legacyAllowList = params.get(LANG_WHITELIST, ""); - if (legacyAllowList.length() > 0) { + final String legacyAllowList = params.get(LANG_WHITELIST, "").trim(); + if (!legacyAllowList.isEmpty()) { // nowarn compile time string concatenation log.warn( LANG_WHITELIST @@ -120,11 +120,10 @@ private void initParams(SolrParams params) { + LANG_ALLOWLIST + " instead."); // nowarn } - if (params.get(LANG_ALLOWLIST, legacyAllowList).length() > 0) { - for (String lang : params.get(LANG_ALLOWLIST, "").split(",")) { - langAllowlist.add(lang); - } - } + Arrays.stream(params.get(LANG_ALLOWLIST, legacyAllowList).split(",")) + .map(String::trim) + .filter(lang -> !lang.isEmpty()) + .forEach(langAllowlist::add); // Mapping params (field centric) enableMapping = params.getBool(MAP_ENABLE, false); diff --git a/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java b/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java index 4d8d398a25c..15e62d11a50 100644 --- a/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java +++ b/solr/modules/langid/src/test/org/apache/solr/update/processor/LanguageIdentifierUpdateProcessorFactoryTestCase.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Set; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.params.ModifiableSolrParams; @@ -464,6 +465,31 @@ public void testMapIndividual() throws Exception { assertTrue(mappedIndividual.containsKey("text2_ru")); } + @Test + public void testAllowlist() throws Exception { + ModifiableSolrParams parameters = new ModifiableSolrParams(); + parameters.add("langid.fl", "name,subject"); + parameters.add("langid.langField", "language_s"); + parameters.add("langid.allowlist", "no,en ,, ,sv, sv"); + liProcessor = createLangIdProcessor(parameters); + + // Make sure that empty language codes have been filtered out and others trimmed. + assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist); + } + + @Test + public void testAllowlistBackwardsCompatabilityWithLegacyAllowlist() throws Exception { + // The "legacy allowlist" is "langid.whitelist" + ModifiableSolrParams parameters = new ModifiableSolrParams(); + parameters.add("langid.fl", "name,subject"); + parameters.add("langid.langField", "language_s"); + parameters.add("langid.whitelist", "no,en ,, ,sv, sv"); + liProcessor = createLangIdProcessor(parameters); + + // Make sure that empty language codes have been filtered out and others trimmed. + assertEquals(Set.of("no", "en", "sv"), liProcessor.langAllowlist); + } + // Various utility methods private SolrInputDocument englishDoc() {