Skip to content

Commit 92a7d38

Browse files
authored
Merge branch 'main' into 2025/02/07/post-recovery-merge-bump-version
2 parents 76bdfb2 + 2c6dd6c commit 92a7d38

File tree

88 files changed

+1582
-549
lines changed

Some content is hidden

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

88 files changed

+1582
-549
lines changed

client/test/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ dependencies {
2828
api "org.hamcrest:hamcrest:${versions.hamcrest}"
2929

3030
// mockito
31-
api 'org.mockito:mockito-core:5.11.0'
32-
api 'org.mockito:mockito-subclass:5.11.0'
33-
api 'net.bytebuddy:byte-buddy:1.14.12'
31+
api 'org.mockito:mockito-core:5.15.2'
32+
api 'org.mockito:mockito-subclass:5.15.2'
33+
api 'net.bytebuddy:byte-buddy:1.15.11'
3434
api 'org.objenesis:objenesis:3.3'
3535
}
3636

docs/changelog/120355.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120355
2+
summary: Ensure cluster string could be quoted
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/120944.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 120944
2+
summary: Aggregations cancellation after collection
3+
area: Aggregations
4+
type: bug
5+
issues:
6+
- 108701

docs/changelog/121196.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121196
2+
summary: Fix geoip databases index access after system feature migration
3+
area: Ingest Node
4+
type: bug
5+
issues: []

gradle/build.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apache-compress = "org.apache.commons:commons-compress:1.26.1"
1111
apache-rat = "org.apache.rat:apache-rat:0.11"
1212
asm = { group = "org.ow2.asm", name="asm", version.ref="asm" }
1313
asm-tree = { group = "org.ow2.asm", name="asm-tree", version.ref="asm" }
14-
bytebuddy = "net.bytebuddy:byte-buddy:1.14.12"
14+
bytebuddy = "net.bytebuddy:byte-buddy:1.15.11"
1515
checkstyle = "com.puppycrawl.tools:checkstyle:10.3"
1616
commons-codec = "commons-codec:commons-codec:1.11"
1717
commmons-io = "commons-io:commons-io:2.2"

gradle/verification-metadata.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,9 +1724,9 @@
17241724
<sha256 value="1d31696445697720527091754369082a6651bd49781b6005deb94e56753406f9" origin="Generated by Gradle"/>
17251725
</artifact>
17261726
</component>
1727-
<component group="net.bytebuddy" name="byte-buddy" version="1.14.12">
1728-
<artifact name="byte-buddy-1.14.12.jar">
1729-
<sha256 value="970636134d61c183b19f8f58fa631e30d2f2abca344b37848a393cac7863dd70" origin="Generated by Gradle"/>
1727+
<component group="net.bytebuddy" name="byte-buddy" version="1.15.11">
1728+
<artifact name="byte-buddy-1.15.11.jar">
1729+
<sha256 value="fa08998aae1e7bdae83bde0712c50e8444d71c0e0c196bb2247ade8d4ad0eb90" origin="Generated by Gradle"/>
17301730
</artifact>
17311731
</component>
17321732
<component group="net.java.dev.jets3t" name="jets3t" version="0.9.0">
@@ -4118,14 +4118,14 @@
41184118
<sha256 value="f97483ba0944b9fa133aa29638764ddbeadb51ec3dbc02074c58fa2caecd07fa" origin="Generated by Gradle"/>
41194119
</artifact>
41204120
</component>
4121-
<component group="org.mockito" name="mockito-core" version="5.11.0">
4122-
<artifact name="mockito-core-5.11.0.jar">
4123-
<sha256 value="f076c96b1f49b8d9bc42e46b0969aaf5684c40c8b5b679d400e5d880073a0e00" origin="Generated by Gradle"/>
4121+
<component group="org.mockito" name="mockito-core" version="5.15.2">
4122+
<artifact name="mockito-core-5.15.2.jar">
4123+
<sha256 value="bf48b7372d9491d5ec8aebb4cdd187d15663931599c0fbe7410166ce0e1e58ff" origin="Generated by Gradle"/>
41244124
</artifact>
41254125
</component>
4126-
<component group="org.mockito" name="mockito-subclass" version="5.11.0">
4127-
<artifact name="mockito-subclass-5.11.0.jar">
4128-
<sha256 value="61e65116bf6178cd3a5f1cecc0d73d68395e7c175d07a7f9478650f55b36fb1d" origin="Generated by Gradle"/>
4126+
<component group="org.mockito" name="mockito-subclass" version="5.15.2">
4127+
<artifact name="mockito-subclass-5.15.2.jar">
4128+
<sha256 value="bf332f658d5437446525911449da3474be170053735bf870ac2caaeaffc2fd34" origin="Generated by Gradle"/>
41294129
</artifact>
41304130
</component>
41314131
<component group="org.mortbay.jetty" name="jetty" version="6.1.26">

libs/entitlement/qa/src/javaRestTest/java/org/elasticsearch/entitlement/qa/AbstractEntitlementsIT.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ public abstract class AbstractEntitlementsIT extends ESRestTestCase {
3434
Map.of("properties", List.of("es.entitlements.checkSetSystemProperty", "es.entitlements.checkClearSystemProperty"))
3535
)
3636
);
37-
38-
builder.value(Map.of("file", Map.of("path", tempDir.resolve("read_dir"), "mode", "read")));
39-
builder.value(Map.of("file", Map.of("path", tempDir.resolve("read_write_dir"), "mode", "read_write")));
40-
builder.value(Map.of("file", Map.of("path", tempDir.resolve("read_file"), "mode", "read")));
41-
builder.value(Map.of("file", Map.of("path", tempDir.resolve("read_write_file"), "mode", "read_write")));
37+
builder.value(
38+
Map.of(
39+
"files",
40+
List.of(
41+
Map.of("path", tempDir.resolve("read_dir"), "mode", "read"),
42+
Map.of("path", tempDir.resolve("read_write_dir"), "mode", "read_write"),
43+
Map.of("path", tempDir.resolve("read_file"), "mode", "read"),
44+
Map.of("path", tempDir.resolve("read_write_file"), "mode", "read_write")
45+
)
46+
)
47+
);
4248
};
4349

4450
private final String actionName;

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTree.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
package org.elasticsearch.entitlement.runtime.policy;
1111

12-
import org.elasticsearch.entitlement.runtime.policy.entitlements.FileEntitlement;
12+
import org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement;
1313

1414
import java.nio.file.Path;
1515
import java.util.ArrayList;
@@ -20,18 +20,19 @@
2020
import static org.elasticsearch.core.PathUtils.getDefaultFileSystem;
2121

2222
public final class FileAccessTree {
23-
public static final FileAccessTree EMPTY = new FileAccessTree(List.of());
23+
public static final FileAccessTree EMPTY = new FileAccessTree(FilesEntitlement.EMPTY);
2424
private static final String FILE_SEPARATOR = getDefaultFileSystem().getSeparator();
2525

2626
private final String[] readPaths;
2727
private final String[] writePaths;
2828

29-
private FileAccessTree(List<FileEntitlement> fileEntitlements) {
29+
private FileAccessTree(FilesEntitlement filesEntitlement) {
3030
List<String> readPaths = new ArrayList<>();
3131
List<String> writePaths = new ArrayList<>();
32-
for (FileEntitlement fileEntitlement : fileEntitlements) {
33-
String path = normalizePath(Path.of(fileEntitlement.path()));
34-
if (fileEntitlement.mode() == FileEntitlement.Mode.READ_WRITE) {
32+
for (FilesEntitlement.FileData fileData : filesEntitlement.filesData()) {
33+
var path = normalizePath(Path.of(fileData.path()));
34+
var mode = fileData.mode();
35+
if (mode == FilesEntitlement.Mode.READ_WRITE) {
3536
writePaths.add(path);
3637
}
3738
readPaths.add(path);
@@ -44,8 +45,8 @@ private FileAccessTree(List<FileEntitlement> fileEntitlements) {
4445
this.writePaths = writePaths.toArray(new String[0]);
4546
}
4647

47-
public static FileAccessTree of(List<FileEntitlement> fileEntitlements) {
48-
return new FileAccessTree(fileEntitlements);
48+
public static FileAccessTree of(FilesEntitlement filesEntitlement) {
49+
return new FileAccessTree(filesEntitlement);
4950
}
5051

5152
boolean canRead(Path path) {

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.elasticsearch.entitlement.runtime.policy.entitlements.CreateClassLoaderEntitlement;
1717
import org.elasticsearch.entitlement.runtime.policy.entitlements.Entitlement;
1818
import org.elasticsearch.entitlement.runtime.policy.entitlements.ExitVMEntitlement;
19-
import org.elasticsearch.entitlement.runtime.policy.entitlements.FileEntitlement;
19+
import org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement;
2020
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
2121
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
2222
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
@@ -73,14 +73,16 @@ public static ModuleEntitlements none(String componentName) {
7373
}
7474

7575
public static ModuleEntitlements from(String componentName, List<Entitlement> entitlements) {
76-
var fileEntitlements = entitlements.stream()
77-
.filter(e -> e.getClass().equals(FileEntitlement.class))
78-
.map(e -> (FileEntitlement) e)
79-
.toList();
76+
FilesEntitlement filesEntitlement = FilesEntitlement.EMPTY;
77+
for (Entitlement entitlement : entitlements) {
78+
if (entitlement instanceof FilesEntitlement) {
79+
filesEntitlement = (FilesEntitlement) entitlement;
80+
}
81+
}
8082
return new ModuleEntitlements(
8183
componentName,
8284
entitlements.stream().collect(groupingBy(Entitlement::getClass)),
83-
FileAccessTree.of(fileEntitlements)
85+
FileAccessTree.of(filesEntitlement)
8486
);
8587
}
8688

@@ -164,23 +166,14 @@ private static Map<String, List<Entitlement>> buildScopeEntitlementsMap(Policy p
164166
}
165167

166168
private static void validateEntitlementsPerModule(String componentName, String moduleName, List<Entitlement> entitlements) {
167-
Set<Class<? extends Entitlement>> flagEntitlements = new HashSet<>();
169+
Set<Class<? extends Entitlement>> found = new HashSet<>();
168170
for (var e : entitlements) {
169-
if (e instanceof FileEntitlement) {
170-
continue;
171-
}
172-
if (flagEntitlements.contains(e.getClass())) {
171+
if (found.contains(e.getClass())) {
173172
throw new IllegalArgumentException(
174-
"["
175-
+ componentName
176-
+ "] using module ["
177-
+ moduleName
178-
+ "] found duplicate flag entitlements ["
179-
+ e.getClass().getName()
180-
+ "]"
173+
"[" + componentName + "] using module [" + moduleName + "] found duplicate entitlement [" + e.getClass().getName() + "]"
181174
);
182175
}
183-
flagEntitlements.add(e.getClass());
176+
found.add(e.getClass());
184177
}
185178
}
186179

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyParser.java

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import org.elasticsearch.entitlement.runtime.policy.entitlements.CreateClassLoaderEntitlement;
1313
import org.elasticsearch.entitlement.runtime.policy.entitlements.Entitlement;
14-
import org.elasticsearch.entitlement.runtime.policy.entitlements.FileEntitlement;
14+
import org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement;
1515
import org.elasticsearch.entitlement.runtime.policy.entitlements.InboundNetworkEntitlement;
1616
import org.elasticsearch.entitlement.runtime.policy.entitlements.LoadNativeLibrariesEntitlement;
1717
import org.elasticsearch.entitlement.runtime.policy.entitlements.OutboundNetworkEntitlement;
@@ -46,7 +46,7 @@
4646
public class PolicyParser {
4747

4848
private static final Map<String, Class<?>> EXTERNAL_ENTITLEMENTS = Stream.of(
49-
FileEntitlement.class,
49+
FilesEntitlement.class,
5050
CreateClassLoaderEntitlement.class,
5151
SetHttpsConnectionPropertiesEntitlement.class,
5252
OutboundNetworkEntitlement.class,
@@ -197,34 +197,41 @@ protected Entitlement parseEntitlement(String scopeName, String entitlementType)
197197
? entitlementConstructor.getParameterTypes()
198198
: entitlementMethod.getParameterTypes();
199199
String[] parametersNames = entitlementMetadata.parameterNames();
200+
Object[] parameterValues = new Object[parameterTypes.length];
200201

201202
if (parameterTypes.length != 0 || parametersNames.length != 0) {
202-
if (policyParser.nextToken() != XContentParser.Token.START_OBJECT) {
203-
throw newPolicyParserException(scopeName, entitlementType, "expected entitlement parameters");
204-
}
205-
}
206-
207-
Map<String, Object> parsedValues = policyParser.map();
203+
if (policyParser.nextToken() == XContentParser.Token.START_OBJECT) {
204+
Map<String, Object> parsedValues = policyParser.map();
208205

209-
Object[] parameterValues = new Object[parameterTypes.length];
210-
for (int parameterIndex = 0; parameterIndex < parameterTypes.length; ++parameterIndex) {
211-
String parameterName = parametersNames[parameterIndex];
212-
Object parameterValue = parsedValues.remove(parameterName);
213-
if (parameterValue == null) {
214-
throw newPolicyParserException(scopeName, entitlementType, "missing entitlement parameter [" + parameterName + "]");
215-
}
216-
Class<?> parameterType = parameterTypes[parameterIndex];
217-
if (parameterType.isAssignableFrom(parameterValue.getClass()) == false) {
218-
throw newPolicyParserException(
219-
scopeName,
220-
entitlementType,
221-
"unexpected parameter type [" + parameterType.getSimpleName() + "] for entitlement parameter [" + parameterName + "]"
222-
);
206+
for (int parameterIndex = 0; parameterIndex < parameterTypes.length; ++parameterIndex) {
207+
String parameterName = parametersNames[parameterIndex];
208+
Object parameterValue = parsedValues.remove(parameterName);
209+
if (parameterValue == null) {
210+
throw newPolicyParserException(scopeName, entitlementType, "missing entitlement parameter [" + parameterName + "]");
211+
}
212+
Class<?> parameterType = parameterTypes[parameterIndex];
213+
if (parameterType.isAssignableFrom(parameterValue.getClass()) == false) {
214+
throw newPolicyParserException(
215+
scopeName,
216+
entitlementType,
217+
"unexpected parameter type ["
218+
+ parameterType.getSimpleName()
219+
+ "] for entitlement parameter ["
220+
+ parameterName
221+
+ "]"
222+
);
223+
}
224+
parameterValues[parameterIndex] = parameterValue;
225+
}
226+
if (parsedValues.isEmpty() == false) {
227+
throw newPolicyParserException(scopeName, entitlementType, "extraneous entitlement parameter(s) " + parsedValues);
228+
}
229+
} else if (policyParser.currentToken() == XContentParser.Token.START_ARRAY) {
230+
List<Object> parsedValues = policyParser.list();
231+
parameterValues[0] = parsedValues;
232+
} else {
233+
throw newPolicyParserException(scopeName, entitlementType, "expected entitlement parameters");
223234
}
224-
parameterValues[parameterIndex] = parameterValue;
225-
}
226-
if (parsedValues.isEmpty() == false) {
227-
throw newPolicyParserException(scopeName, entitlementType, "extraneous entitlement parameter(s) " + parsedValues);
228235
}
229236

230237
try {

0 commit comments

Comments
 (0)