diff --git a/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexValidator.java b/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexValidator.java index 19bd8a0f8270f..32887235f69c6 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexValidator.java +++ b/modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexValidator.java @@ -101,15 +101,6 @@ static CharacterRunAutomaton buildRemoteWhitelist(List whitelist) { } Automaton automaton = Regex.simpleMatchToAutomaton(whitelist.toArray(Strings.EMPTY_ARRAY)); automaton = Operations.determinize(automaton, Operations.DEFAULT_DETERMINIZE_WORK_LIMIT); - if (Operations.isTotal(automaton)) { - throw new IllegalArgumentException( - "Refusing to start because whitelist " - + whitelist - + " accepts all addresses. " - + "This would allow users to reindex-from-remote any URL they like effectively having Elasticsearch make HTTP GETs " - + "for them." - ); - } return new CharacterRunAutomaton(automaton); } diff --git a/modules/reindex/src/test/java/org/elasticsearch/reindex/ReindexFromRemoteWhitelistTests.java b/modules/reindex/src/test/java/org/elasticsearch/reindex/ReindexFromRemoteWhitelistTests.java index 3219c45926f38..4264e7b273436 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/reindex/ReindexFromRemoteWhitelistTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/reindex/ReindexFromRemoteWhitelistTests.java @@ -16,7 +16,6 @@ import java.net.UnknownHostException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static java.util.Collections.emptyList; @@ -112,35 +111,12 @@ public void testUnwhitelistedRemote() { assertEquals("[not in list:" + port + "] not whitelisted in reindex.remote.whitelist", e.getMessage()); } - public void testRejectMatchAll() { - assertMatchesTooMuch(singletonList("*")); - assertMatchesTooMuch(singletonList("**")); - assertMatchesTooMuch(singletonList("***")); - assertMatchesTooMuch(Arrays.asList("realstuff", "*")); - assertMatchesTooMuch(Arrays.asList("*", "realstuff")); - List random = randomWhitelist(); - random.add("*"); - assertMatchesTooMuch(random); - } - public void testIPv6Address() { List whitelist = randomWhitelist(); whitelist.add("[::1]:*"); checkRemoteWhitelist(buildRemoteWhitelist(whitelist), newRemoteInfo("[::1]", 9200)); } - private void assertMatchesTooMuch(List whitelist) { - Exception e = expectThrows(IllegalArgumentException.class, () -> buildRemoteWhitelist(whitelist)); - assertEquals( - "Refusing to start because whitelist " - + whitelist - + " accepts all addresses. " - + "This would allow users to reindex-from-remote any URL they like effectively having Elasticsearch make HTTP GETs " - + "for them.", - e.getMessage() - ); - } - private List randomWhitelist() { int size = between(1, 100); List whitelist = new ArrayList<>(size);