Skip to content

Commit 066d8b6

Browse files
committed
Merge branch 'main' into lucene_snapshot
2 parents 4e88e93 + f9d813a commit 066d8b6

File tree

54 files changed

+2023
-916
lines changed

Some content is hidden

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

54 files changed

+2023
-916
lines changed

distribution/tools/keystore-cli/src/test/java/org/elasticsearch/cli/keystore/AddStringKeyStoreCommandTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public void testStdinInputWithCarriageReturn() throws Exception {
193193
String password = "keystorepassword";
194194
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
195195
terminal.addSecretInput(password);
196-
terminal.addSecretInput("Typedthisandhitenter\r");
196+
terminal.addSecretInput("Typedthisandhitenter\r\n");
197197
execute("-x", "foo");
198198
assertSecureString("foo", "Typedthisandhitenter", password);
199199
}

docs/changelog/126397.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 126397
2+
summary: "ESQL: Preserve single aggregate when all attributes are pruned"
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 126392

docs/changelog/126653.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126653
2+
summary: Retry shard movements during ESQL query
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/reference/elasticsearch/mapping-reference/mapping-date-format.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Many APIs which support date values also support [date math](/reference/elastics
2727

2828
## Custom date formats [custom-date-formats]
2929

30-
Completely customizable date formats are supported. The syntax for these is explained in [DateTimeFormatter docs](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.md).
30+
Completely customizable date formats are supported. The syntax for these is explained in [DateTimeFormatter docs](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DateTimeFormatter.html).
3131

3232
Note that while the built-in formats for week dates use the ISO definition of weekyears, custom formatters using the `Y`, `W`, or `w` field specifiers use the JDK locale definition of weekyears. This can result in different values between the built-in formats and custom formats for week dates.
3333

docs/release-notes/known-issues.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,23 @@ mapped_pages:
77
# Elasticsearch known issues [elasticsearch-known-issues]
88
Known issues are significant defects or limitations that may impact your implementation. These issues are actively being worked on and will be addressed in a future release. Review the Elasticsearch known issues to help you make informed decisions, such as upgrading to a new version.
99

10+
## 9.0.0 [elasticsearch-9.0.0-known-issues]
11+
* Elasticsearch on Windows might fail to start, or might forbid some file-related operations, when referencing paths with a case different from the one stored by the filesystem. Windows treats paths as case-insensitive, but the filesystem stores them with case. Entitlements, the new security system used by Elasticsearch, treat all paths as case-sensitive, and can therefore prevent access to a path that should be accessible.
12+
13+
For example: If Elasticsearch is installed in `C:\ELK\elasticsearch`, and you try to launch it as `c:\elk\elasticsearch\bin\elasticsearch.bat`, you will get a `NotEntitledException` while booting. This is because Elasticsearch blocks access to `c:\elk\elasticsearch`, because does not match `C:\ELK\elasticsearch`. \
14+
This issue will be fixed in a future patch release (see [PR #126990](https://github.com/elastic/elasticsearch/pull/126990)).
15+
16+
As a workaround, make sure that all paths you specify have the same casing as the paths stored in the filesystem. Files and directory names should be entered as they appear in Windows Explorer or in a command prompt. This applies to paths specified in the command line, config files, environment variables and secure settings.
17+
18+
* Active Directory authentication is blocked by default. Entitlements, the new security system used by Elasticsearch, has a policy for the `x-pack-core` module that is too restrictive, and does not allow the LDAP library used for AD authentication to perform outbound network connections. This issue will be fixed in a future patch release (see [PR #126992](https://github.com/elastic/elasticsearch/pull/126992)).
19+
20+
As a workaround, you can temporarily patch the policy using a JVM option:
21+
22+
1. Create a file called `${ES_CONF_PATH}/jvm_options/workaround-127061.options`.
23+
2. Add the following line to the new file:
24+
25+
```
26+
-Des.entitlements.policy.x-pack-core=dmVyc2lvbnM6CiAgLSA4LjE4LjAKICAtIDkuMC4wCnBvbGljeToKICB1bmJvdW5kaWQubGRhcHNkazoKICAgIC0gc2V0X2h0dHBzX2Nvbm5lY3Rpb25fcHJvcGVydGllcwogICAgLSBvdXRib3VuZF9uZXR3b3Jr
27+
```
28+
29+
For information about editing your JVM settings, refer to [JVM settings](https://www.elastic.co/docs/reference/elasticsearch/jvm-settings).
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
/**
11+
* Contains classes that need to be used directly from instrumented methods.
12+
* It's a minimal shim that is patched into the {@code java.base} module so that it is callable from the class library methods instrumented
13+
* by the agent. The shim retains a {@link org.elasticsearch.entitlement.bridge.EntitlementChecker} instance (inside its
14+
* {@link org.elasticsearch.entitlement.bridge.EntitlementCheckerHandle} holder) and forwards the entitlement checks to the main library,
15+
* that exists in the system classloader.
16+
* {@link org.elasticsearch.entitlement.bridge.EntitlementChecker} holds all the entitlements check definitions, one for each instrumented
17+
* method.
18+
* <p>
19+
* In order to work across multiple Java versions, this project uses multi-release jars via the {@code mrjar} plugin, which makes it is
20+
* possible to specify classes for specific Java versions in specific {@code src} folders (e.g. {@code main23} for classes available to
21+
* Java 23+).
22+
* All the versioned Java classes are merged into the bridge jar. Therefore, we must prefix the class name
23+
* with the version, e.g. {@code Java23EntitlementCheckerHandle} and {@code Java23EntitlementChecker}.
24+
* </p>
25+
*/
26+
package org.elasticsearch.entitlement.bridge;

libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
import com.sun.tools.attach.VirtualMachine;
1616

1717
import org.elasticsearch.core.Nullable;
18+
import org.elasticsearch.core.PathUtils;
1819
import org.elasticsearch.core.SuppressForbidden;
1920
import org.elasticsearch.entitlement.initialization.EntitlementInitialization;
21+
import org.elasticsearch.entitlement.runtime.policy.PathLookup;
22+
import org.elasticsearch.entitlement.runtime.policy.PathLookupImpl;
2023
import org.elasticsearch.entitlement.runtime.policy.Policy;
24+
import org.elasticsearch.entitlement.runtime.policy.PolicyManager;
2125
import org.elasticsearch.logging.LogManager;
2226
import org.elasticsearch.logging.Logger;
2327

@@ -36,36 +40,16 @@ public class EntitlementBootstrap {
3640
public record BootstrapArgs(
3741
@Nullable Policy serverPolicyPatch,
3842
Map<String, Policy> pluginPolicies,
39-
Function<Class<?>, String> pluginResolver,
40-
Function<String, Stream<String>> settingResolver,
41-
Path[] dataDirs,
42-
Path[] sharedRepoDirs,
43-
Path configDir,
44-
Path libDir,
45-
Path modulesDir,
46-
Path pluginsDir,
43+
Function<Class<?>, PolicyManager.PolicyScope> scopeResolver,
44+
PathLookup pathLookup,
4745
Map<String, Path> sourcePaths,
48-
Path logsDir,
49-
Path tempDir,
50-
Path pidFile,
5146
Set<Class<?>> suppressFailureLogClasses
5247
) {
5348
public BootstrapArgs {
5449
requireNonNull(pluginPolicies);
55-
requireNonNull(pluginResolver);
56-
requireNonNull(settingResolver);
57-
requireNonNull(dataDirs);
58-
if (dataDirs.length == 0) {
59-
throw new IllegalArgumentException("must provide at least one data directory");
60-
}
61-
requireNonNull(sharedRepoDirs);
62-
requireNonNull(configDir);
63-
requireNonNull(libDir);
64-
requireNonNull(modulesDir);
65-
requireNonNull(pluginsDir);
50+
requireNonNull(scopeResolver);
51+
requireNonNull(pathLookup);
6652
requireNonNull(sourcePaths);
67-
requireNonNull(logsDir);
68-
requireNonNull(tempDir);
6953
requireNonNull(suppressFailureLogClasses);
7054
}
7155
}
@@ -82,7 +66,7 @@ public static BootstrapArgs bootstrapArgs() {
8266
*
8367
* @param serverPolicyPatch a policy with additional entitlements to patch the embedded server layer policy
8468
* @param pluginPolicies a map holding policies for plugins (and modules), by plugin (or module) name.
85-
* @param pluginResolver a functor to map a Java Class to the plugin it belongs to (the plugin name).
69+
* @param scopeResolver a functor to map a Java Class to the component and module it belongs to.
8670
* @param settingResolver a functor to resolve a setting name pattern for one or more Elasticsearch settings.
8771
* @param dataDirs data directories for Elasticsearch
8872
* @param sharedRepoDirs shared repository directories for Elasticsearch
@@ -99,7 +83,7 @@ public static BootstrapArgs bootstrapArgs() {
9983
public static void bootstrap(
10084
Policy serverPolicyPatch,
10185
Map<String, Policy> pluginPolicies,
102-
Function<Class<?>, String> pluginResolver,
86+
Function<Class<?>, PolicyManager.PolicyScope> scopeResolver,
10387
Function<String, Stream<String>> settingResolver,
10488
Path[] dataDirs,
10589
Path[] sharedRepoDirs,
@@ -120,24 +104,35 @@ public static void bootstrap(
120104
EntitlementBootstrap.bootstrapArgs = new BootstrapArgs(
121105
serverPolicyPatch,
122106
pluginPolicies,
123-
pluginResolver,
124-
settingResolver,
125-
dataDirs,
126-
sharedRepoDirs,
127-
configDir,
128-
libDir,
129-
modulesDir,
130-
pluginsDir,
107+
scopeResolver,
108+
new PathLookupImpl(
109+
getUserHome(),
110+
configDir,
111+
dataDirs,
112+
sharedRepoDirs,
113+
libDir,
114+
modulesDir,
115+
pluginsDir,
116+
logsDir,
117+
tempDir,
118+
pidFile,
119+
settingResolver
120+
),
131121
sourcePaths,
132-
logsDir,
133-
tempDir,
134-
pidFile,
135122
suppressFailureLogClasses
136123
);
137124
exportInitializationToAgent();
138125
loadAgent(findAgentJar());
139126
}
140127

128+
private static Path getUserHome() {
129+
String userHome = System.getProperty("user.home");
130+
if (userHome == null) {
131+
throw new IllegalStateException("user.home system property is required");
132+
}
133+
return PathUtils.get(userHome);
134+
}
135+
141136
@SuppressForbidden(reason = "The VirtualMachine API is the only way to attach a java agent dynamically")
142137
private static void loadAgent(String agentPath) {
143138
try {

0 commit comments

Comments
 (0)