Skip to content

Commit e009a84

Browse files
committed
Merge remote-tracking branch 'origin/main' into NodeStatsOptimisation-ClusterStats-NodeIndicesStats3
Signed-off-by: Pranshu Shukla <[email protected]>
2 parents a267aef + bda8393 commit e009a84

File tree

115 files changed

+2263
-547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+2263
-547
lines changed

CHANGELOG.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1313
- Add batching supported processor base type AbstractBatchingProcessor ([#14554](https://github.com/opensearch-project/OpenSearch/pull/14554))
1414
- Fix race condition while parsing derived fields from search definition ([14445](https://github.com/opensearch-project/OpenSearch/pull/14445))
1515
- Add allowlist setting for ingest-common and search-pipeline-common processors ([#14439](https://github.com/opensearch-project/OpenSearch/issues/14439))
16+
- Create SystemIndexRegistry with helper method matchesSystemIndex ([#14415](https://github.com/opensearch-project/OpenSearch/pull/14415))
1617

1718
### Dependencies
1819
- Bump `org.gradle.test-retry` from 1.5.8 to 1.5.9 ([#13442](https://github.com/opensearch-project/OpenSearch/pull/13442))
1920
- Update to Apache Lucene 9.11.0 ([#14042](https://github.com/opensearch-project/OpenSearch/pull/14042))
2021
- Bump `netty` from 4.1.110.Final to 4.1.111.Final ([#14356](https://github.com/opensearch-project/OpenSearch/pull/14356))
2122
- Bump `org.wiremock:wiremock-standalone` from 3.3.1 to 3.6.0 ([#14361](https://github.com/opensearch-project/OpenSearch/pull/14361))
22-
- Bump `reactor` from 3.5.17 to 3.5.18 ([#14395](https://github.com/opensearch-project/OpenSearch/pull/14395))
23-
- Bump `reactor-netty` from 1.1.19 to 1.1.20 ([#14395](https://github.com/opensearch-project/OpenSearch/pull/14395))
23+
- Bump `reactor` from 3.5.17 to 3.5.19 ([#14395](https://github.com/opensearch-project/OpenSearch/pull/14395), [#14697](https://github.com/opensearch-project/OpenSearch/pull/14697))
24+
- Bump `reactor-netty` from 1.1.19 to 1.1.21 ([#14395](https://github.com/opensearch-project/OpenSearch/pull/14395), [#14697](https://github.com/opensearch-project/OpenSearch/pull/14697))
2425
- Bump `commons-net:commons-net` from 3.10.0 to 3.11.1 ([#14396](https://github.com/opensearch-project/OpenSearch/pull/14396))
2526
- Bump `com.nimbusds:nimbus-jose-jwt` from 9.37.3 to 9.40 ([#14398](https://github.com/opensearch-project/OpenSearch/pull/14398))
2627
- Bump `org.apache.commons:commons-configuration2` from 2.10.1 to 2.11.0 ([#14399](https://github.com/opensearch-project/OpenSearch/pull/14399))
2728
- Bump `com.gradle.develocity` from 3.17.4 to 3.17.5 ([#14397](https://github.com/opensearch-project/OpenSearch/pull/14397))
28-
- Bump `opentelemetry` from 1.36.0 to 1.39.0 ([#14457](https://github.com/opensearch-project/OpenSearch/pull/14457))
29-
- Bump `azure-identity` from 1.11.4 to 1.13.0, Bump `msal4j` from 1.14.3 to 1.15.1, Bump `msal4j-persistence-extension` from 1.2.0 to 1.3.0 ([#14506](https://github.com/opensearch-project/OpenSearch/pull/14506))
29+
- Bump `opentelemetry` from 1.36.0 to 1.40.0 ([#14457](https://github.com/opensearch-project/OpenSearch/pull/14457), [#14674](https://github.com/opensearch-project/OpenSearch/pull/14674))
30+
- Bump `opentelemetry-semconv` from 1.25.0-alpha to 1.26.0-alpha ([#14674](https://github.com/opensearch-project/OpenSearch/pull/14674))
31+
- Bump `azure-identity` from 1.11.4 to 1.13.0, Bump `msal4j` from 1.14.3 to 1.15.1, Bump `msal4j-persistence-extension` from 1.2.0 to 1.3.0 ([#14506](https://github.com/opensearch-project/OpenSearch/pull/14673))
3032
- Bump `com.azure:azure-storage-common` from 12.21.2 to 12.25.1 ([#14517](https://github.com/opensearch-project/OpenSearch/pull/14517))
3133
- Bump `com.microsoft.azure:msal4j` from 1.15.1 to 1.16.0 ([#14610](https://github.com/opensearch-project/OpenSearch/pull/14610))
3234
- Bump `com.github.spullara.mustache.java:compiler` from 0.9.13 to 0.9.14 ([#14672](https://github.com/opensearch-project/OpenSearch/pull/14672))
3335
- Bump `net.minidev:accessors-smart` from 2.5.0 to 2.5.1 ([#14673](https://github.com/opensearch-project/OpenSearch/pull/14673))
36+
- Bump `jackson` from 2.17.1 to 2.17.2 ([#14687](https://github.com/opensearch-project/OpenSearch/pull/14687))
3437

3538
### Changed
3639
- [Tiered Caching] Move query recomputation logic outside write lock ([#14187](https://github.com/opensearch-project/OpenSearch/pull/14187))
@@ -49,6 +52,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4952
- Fix bug in SBP cancellation logic ([#13259](https://github.com/opensearch-project/OpenSearch/pull/13474))
5053
- Fix handling of Short and Byte data types in ScriptProcessor ingest pipeline ([#14379](https://github.com/opensearch-project/OpenSearch/issues/14379))
5154
- Switch to iterative version of WKT format parser ([#14086](https://github.com/opensearch-project/OpenSearch/pull/14086))
55+
- Fix match_phrase_prefix_query not working on text field with multiple values and index_prefixes ([#10959](https://github.com/opensearch-project/OpenSearch/pull/10959))
5256
- Fix the computed max shards of cluster to avoid int overflow ([#14155](https://github.com/opensearch-project/OpenSearch/pull/14155))
5357
- Fixed rest-high-level client searchTemplate & mtermVectors endpoints to have a leading slash ([#14465](https://github.com/opensearch-project/OpenSearch/pull/14465))
5458
- Write shard level metadata blob when snapshotting searchable snapshot indexes ([#13190](https://github.com/opensearch-project/OpenSearch/pull/13190))
@@ -59,6 +63,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5963
- Fix file cache initialization ([#14004](https://github.com/opensearch-project/OpenSearch/pull/14004))
6064
- Handle NPE in GetResult if "found" field is missing ([#14552](https://github.com/opensearch-project/OpenSearch/pull/14552))
6165
- Refactoring FilterPath.parse by using an iterative approach ([#14200](https://github.com/opensearch-project/OpenSearch/pull/14200))
66+
- Refactoring Grok.validatePatternBank by using an iterative approach ([#14206](https://github.com/opensearch-project/OpenSearch/pull/14206))
6267

6368
### Security
6469

buildSrc/version.properties

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ bundled_jdk = 21.0.3+9
77
# optional dependencies
88
spatial4j = 0.7
99
jts = 1.15.0
10-
jackson = 2.17.1
11-
jackson_databind = 2.17.1
10+
jackson = 2.17.2
11+
jackson_databind = 2.17.2
1212
snakeyaml = 2.1
1313
icu4j = 70.1
1414
supercsv = 2.4.0
@@ -33,8 +33,8 @@ netty = 4.1.111.Final
3333
joda = 2.12.7
3434

3535
# project reactor
36-
reactor_netty = 1.1.20
37-
reactor = 3.5.18
36+
reactor_netty = 1.1.21
37+
reactor = 3.5.19
3838

3939
# client dependencies
4040
httpclient5 = 5.2.1
@@ -74,5 +74,5 @@ jzlib = 1.1.3
7474
resteasy = 6.2.4.Final
7575

7676
# opentelemetry dependencies
77-
opentelemetry = 1.39.0
78-
opentelemetrysemconv = 1.25.0-alpha
77+
opentelemetry = 1.40.0
78+
opentelemetrysemconv = 1.26.0-alpha

client/sniffer/licenses/jackson-core-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
969a35cb35c86512acbadcdbbbfb044c877db814

distribution/tools/upgrade-cli/licenses/jackson-annotations-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
147b7b9412ffff24339f8aba080b292448e08698

distribution/tools/upgrade-cli/licenses/jackson-databind-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e6deb029e5901e027c129341fac39e515066b68c

libs/core/licenses/jackson-core-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
969a35cb35c86512acbadcdbbbfb044c877db814

libs/grok/src/main/java/org/opensearch/grok/Grok.java

+88-34
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@
3737
import java.io.InputStream;
3838
import java.io.InputStreamReader;
3939
import java.nio.charset.StandardCharsets;
40+
import java.util.ArrayDeque;
4041
import java.util.ArrayList;
4142
import java.util.Collections;
43+
import java.util.Deque;
44+
import java.util.HashMap;
45+
import java.util.HashSet;
4246
import java.util.Iterator;
4347
import java.util.LinkedHashMap;
4448
import java.util.List;
4549
import java.util.Locale;
4650
import java.util.Map;
47-
import java.util.Stack;
51+
import java.util.Set;
4852
import java.util.function.Consumer;
4953

5054
import org.jcodings.specific.UTF8Encoding;
@@ -86,6 +90,7 @@ public final class Grok {
8690
UTF8Encoding.INSTANCE,
8791
Syntax.DEFAULT
8892
);
93+
private static final int MAX_PATTERN_DEPTH_SIZE = 500;
8994

9095
private static final int MAX_TO_REGEX_ITERATIONS = 100_000; // sanity limit
9196

@@ -128,7 +133,7 @@ private Grok(
128133
expressionBytes.length,
129134
Option.DEFAULT,
130135
UTF8Encoding.INSTANCE,
131-
message -> logCallBack.accept(message)
136+
logCallBack::accept
132137
);
133138

134139
List<GrokCaptureConfig> captureConfig = new ArrayList<>();
@@ -144,7 +149,7 @@ private Grok(
144149
*/
145150
private void validatePatternBank() {
146151
for (String patternName : patternBank.keySet()) {
147-
validatePatternBank(patternName, new Stack<>());
152+
validatePatternBank(patternName);
148153
}
149154
}
150155

@@ -156,33 +161,84 @@ private void validatePatternBank() {
156161
* a reference to another named pattern. This method will navigate to all these named patterns and
157162
* check for a circular reference.
158163
*/
159-
private void validatePatternBank(String patternName, Stack<String> path) {
160-
String pattern = patternBank.get(patternName);
161-
boolean isSelfReference = pattern.contains("%{" + patternName + "}") || pattern.contains("%{" + patternName + ":");
162-
if (isSelfReference) {
163-
throwExceptionForCircularReference(patternName, pattern);
164-
} else if (path.contains(patternName)) {
165-
// current pattern name is already in the path, fetch its predecessor
166-
String prevPatternName = path.pop();
167-
String prevPattern = patternBank.get(prevPatternName);
168-
throwExceptionForCircularReference(prevPatternName, prevPattern, patternName, path);
169-
}
170-
path.push(patternName);
171-
for (int i = pattern.indexOf("%{"); i != -1; i = pattern.indexOf("%{", i + 1)) {
172-
int begin = i + 2;
173-
int syntaxEndIndex = pattern.indexOf('}', begin);
174-
if (syntaxEndIndex == -1) {
175-
throw new IllegalArgumentException("Malformed pattern [" + patternName + "][" + pattern + "]");
164+
private void validatePatternBank(String initialPatternName) {
165+
Deque<Frame> stack = new ArrayDeque<>();
166+
Set<String> visitedPatterns = new HashSet<>();
167+
Map<String, List<String>> pathMap = new HashMap<>();
168+
169+
List<String> initialPath = new ArrayList<>();
170+
initialPath.add(initialPatternName);
171+
pathMap.put(initialPatternName, initialPath);
172+
stack.push(new Frame(initialPatternName, initialPath, 0));
173+
174+
while (!stack.isEmpty()) {
175+
Frame frame = stack.peek();
176+
String patternName = frame.patternName;
177+
List<String> path = frame.path;
178+
int startIndex = frame.startIndex;
179+
String pattern = patternBank.get(patternName);
180+
181+
if (visitedPatterns.contains(patternName)) {
182+
stack.pop();
183+
continue;
184+
}
185+
186+
visitedPatterns.add(patternName);
187+
boolean foundDependency = false;
188+
189+
for (int i = startIndex; i < pattern.length(); i++) {
190+
if (pattern.startsWith("%{", i)) {
191+
int begin = i + 2;
192+
int syntaxEndIndex = pattern.indexOf('}', begin);
193+
if (syntaxEndIndex == -1) {
194+
throw new IllegalArgumentException("Malformed pattern [" + patternName + "][" + pattern + "]");
195+
}
196+
197+
int semanticNameIndex = pattern.indexOf(':', begin);
198+
int end = semanticNameIndex == -1 ? syntaxEndIndex : Math.min(syntaxEndIndex, semanticNameIndex);
199+
200+
String dependsOnPattern = pattern.substring(begin, end);
201+
202+
if (dependsOnPattern.equals(patternName)) {
203+
throwExceptionForCircularReference(patternName, pattern);
204+
}
205+
206+
if (pathMap.containsKey(dependsOnPattern)) {
207+
throwExceptionForCircularReference(patternName, pattern, dependsOnPattern, path.subList(0, path.size() - 1));
208+
}
209+
210+
List<String> newPath = new ArrayList<>(path);
211+
newPath.add(dependsOnPattern);
212+
pathMap.put(dependsOnPattern, newPath);
213+
214+
stack.push(new Frame(dependsOnPattern, newPath, 0));
215+
frame.startIndex = i + 1;
216+
foundDependency = true;
217+
break;
218+
}
176219
}
177-
int semanticNameIndex = pattern.indexOf(':', begin);
178-
int end = syntaxEndIndex;
179-
if (semanticNameIndex != -1) {
180-
end = Math.min(syntaxEndIndex, semanticNameIndex);
220+
221+
if (!foundDependency) {
222+
pathMap.remove(patternName);
223+
stack.pop();
224+
}
225+
226+
if (stack.size() > MAX_PATTERN_DEPTH_SIZE) {
227+
throw new IllegalArgumentException("Pattern references exceeded maximum depth of " + MAX_PATTERN_DEPTH_SIZE);
181228
}
182-
String dependsOnPattern = pattern.substring(begin, end);
183-
validatePatternBank(dependsOnPattern, path);
184229
}
185-
path.pop();
230+
}
231+
232+
private static class Frame {
233+
String patternName;
234+
List<String> path;
235+
int startIndex;
236+
237+
Frame(String patternName, List<String> path, int startIndex) {
238+
this.patternName = patternName;
239+
this.path = path;
240+
this.startIndex = startIndex;
241+
}
186242
}
187243

188244
private static void throwExceptionForCircularReference(String patternName, String pattern) {
@@ -192,13 +248,13 @@ private static void throwExceptionForCircularReference(String patternName, Strin
192248
private static void throwExceptionForCircularReference(
193249
String patternName,
194250
String pattern,
195-
String originPatterName,
196-
Stack<String> path
251+
String originPatternName,
252+
List<String> path
197253
) {
198254
StringBuilder message = new StringBuilder("circular reference in pattern [");
199255
message.append(patternName).append("][").append(pattern).append("]");
200-
if (originPatterName != null) {
201-
message.append(" back to pattern [").append(originPatterName).append("]");
256+
if (originPatternName != null) {
257+
message.append(" back to pattern [").append(originPatternName).append("]");
202258
}
203259
if (path != null && path.size() > 1) {
204260
message.append(" via patterns [").append(String.join("=>", path)).append("]");
@@ -217,9 +273,7 @@ private String groupMatch(String name, Region region, String pattern) {
217273
int begin = region.getBeg(number);
218274
int end = region.getEnd(number);
219275
return new String(pattern.getBytes(StandardCharsets.UTF_8), begin, end - begin, StandardCharsets.UTF_8);
220-
} catch (StringIndexOutOfBoundsException e) {
221-
return null;
222-
} catch (ValueException e) {
276+
} catch (StringIndexOutOfBoundsException | ValueException e) {
223277
return null;
224278
}
225279
}

libs/grok/src/test/java/org/opensearch/grok/GrokTests.java

+10
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@ public void testCircularReference() {
377377
"circular reference in pattern [NAME5][!!!%{NAME1}!!!] back to pattern [NAME1] " + "via patterns [NAME1=>NAME2=>NAME3=>NAME4]",
378378
e.getMessage()
379379
);
380+
381+
e = expectThrows(IllegalArgumentException.class, () -> {
382+
Map<String, String> bank = new TreeMap<>();
383+
for (int i = 1; i <= 501; i++) {
384+
bank.put("NAME" + i, "!!!%{NAME" + (i + 1) + "}!!!");
385+
}
386+
String pattern = "%{NAME1}";
387+
new Grok(bank, pattern, false, logger::warn);
388+
});
389+
assertEquals("Pattern references exceeded maximum depth of 500", e.getMessage());
380390
}
381391

382392
public void testMalformedPattern() {

libs/x-content/licenses/jackson-core-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
969a35cb35c86512acbadcdbbbfb044c877db814

libs/x-content/licenses/jackson-dataformat-cbor-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
57fa7c1b5104bbc4599278d13933a937ee058e68

libs/x-content/licenses/jackson-dataformat-smile-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20e956b9b6f67138edd39fab7a506ded19638bcb

libs/x-content/licenses/jackson-dataformat-yaml-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
78d2c73dbec62044d7cf3b544b2e0d24a1a093b0

modules/ingest-geoip/licenses/jackson-annotations-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
147b7b9412ffff24339f8aba080b292448e08698

modules/ingest-geoip/licenses/jackson-databind-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e6deb029e5901e027c129341fac39e515066b68c

plugins/crypto-kms/licenses/jackson-annotations-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
147b7b9412ffff24339f8aba080b292448e08698

plugins/crypto-kms/licenses/jackson-databind-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e6deb029e5901e027c129341fac39e515066b68c

plugins/discovery-ec2/licenses/jackson-annotations-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
147b7b9412ffff24339f8aba080b292448e08698

plugins/discovery-ec2/licenses/jackson-databind-2.17.1.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e6deb029e5901e027c129341fac39e515066b68c

plugins/query-insights/src/main/java/org/opensearch/plugin/insights/core/service/TopQueriesService.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,15 @@ public int getTopNSize() {
138138
* @param size the wanted top N size
139139
*/
140140
public void validateTopNSize(final int size) {
141-
if (size > QueryInsightsSettings.MAX_N_SIZE) {
141+
if (size < 1 || size > QueryInsightsSettings.MAX_N_SIZE) {
142142
throw new IllegalArgumentException(
143143
"Top N size setting for ["
144144
+ metricType
145145
+ "]"
146-
+ " should be smaller than max top N size ["
146+
+ " should be between 1 and "
147147
+ QueryInsightsSettings.MAX_N_SIZE
148-
+ "was ("
148+
+ ", was ("
149149
+ size
150-
+ " > "
151-
+ QueryInsightsSettings.MAX_N_SIZE
152150
+ ")"
153151
);
154152
}

plugins/query-insights/src/test/java/org/opensearch/plugin/insights/core/service/TopQueriesServiceTests.java

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public void testValidateTopNSize() {
7878
assertThrows(IllegalArgumentException.class, () -> { topQueriesService.validateTopNSize(QueryInsightsSettings.MAX_N_SIZE + 1); });
7979
}
8080

81+
public void testValidateNegativeTopNSize() {
82+
assertThrows(IllegalArgumentException.class, () -> { topQueriesService.validateTopNSize(-1); });
83+
}
84+
8185
public void testGetTopQueriesWhenNotEnabled() {
8286
topQueriesService.setEnabled(false);
8387
assertThrows(IllegalArgumentException.class, () -> { topQueriesService.getTopQueriesRecords(false); });

plugins/repository-azure/licenses/jackson-annotations-2.17.1.jar.sha1

-1
This file was deleted.

0 commit comments

Comments
 (0)