Skip to content

Commit f5e37e7

Browse files
All reindex.remote.whitelist to be set to * (#135546)
Prior to this change, ES would refuse to start if the `reindex.remote.whitelist` node setting was `*` (or anything else which matches every string). This removes that restriction. The logic did not provide any real security, since it would accept a setting value of `*:*`, which would effectively match everything since the string checked against it was always of the form `<host>:<port>`. It has been agreed that users should be allowed to whitelist everything if they choose, so there is no value to just making it more awkward for them to figure out how to do so.
1 parent 322e5fe commit f5e37e7

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

modules/reindex/src/main/java/org/elasticsearch/reindex/ReindexValidator.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,6 @@ static CharacterRunAutomaton buildRemoteWhitelist(List<String> whitelist) {
101101
}
102102
Automaton automaton = Regex.simpleMatchToAutomaton(whitelist.toArray(Strings.EMPTY_ARRAY));
103103
automaton = Operations.determinize(automaton, Operations.DEFAULT_DETERMINIZE_WORK_LIMIT);
104-
if (Operations.isTotal(automaton)) {
105-
throw new IllegalArgumentException(
106-
"Refusing to start because whitelist "
107-
+ whitelist
108-
+ " accepts all addresses. "
109-
+ "This would allow users to reindex-from-remote any URL they like effectively having Elasticsearch make HTTP GETs "
110-
+ "for them."
111-
);
112-
}
113104
return new CharacterRunAutomaton(automaton);
114105
}
115106

modules/reindex/src/test/java/org/elasticsearch/reindex/ReindexFromRemoteWhitelistTests.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import java.net.UnknownHostException;
1818
import java.util.ArrayList;
19-
import java.util.Arrays;
2019
import java.util.List;
2120

2221
import static java.util.Collections.emptyList;
@@ -112,35 +111,12 @@ public void testUnwhitelistedRemote() {
112111
assertEquals("[not in list:" + port + "] not whitelisted in reindex.remote.whitelist", e.getMessage());
113112
}
114113

115-
public void testRejectMatchAll() {
116-
assertMatchesTooMuch(singletonList("*"));
117-
assertMatchesTooMuch(singletonList("**"));
118-
assertMatchesTooMuch(singletonList("***"));
119-
assertMatchesTooMuch(Arrays.asList("realstuff", "*"));
120-
assertMatchesTooMuch(Arrays.asList("*", "realstuff"));
121-
List<String> random = randomWhitelist();
122-
random.add("*");
123-
assertMatchesTooMuch(random);
124-
}
125-
126114
public void testIPv6Address() {
127115
List<String> whitelist = randomWhitelist();
128116
whitelist.add("[::1]:*");
129117
checkRemoteWhitelist(buildRemoteWhitelist(whitelist), newRemoteInfo("[::1]", 9200));
130118
}
131119

132-
private void assertMatchesTooMuch(List<String> whitelist) {
133-
Exception e = expectThrows(IllegalArgumentException.class, () -> buildRemoteWhitelist(whitelist));
134-
assertEquals(
135-
"Refusing to start because whitelist "
136-
+ whitelist
137-
+ " accepts all addresses. "
138-
+ "This would allow users to reindex-from-remote any URL they like effectively having Elasticsearch make HTTP GETs "
139-
+ "for them.",
140-
e.getMessage()
141-
);
142-
}
143-
144120
private List<String> randomWhitelist() {
145121
int size = between(1, 100);
146122
List<String> whitelist = new ArrayList<>(size);

0 commit comments

Comments
 (0)