Skip to content

Commit b0ec6c0

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot_10
2 parents 08a78e9 + 0697089 commit b0ec6c0

File tree

84 files changed

+1837
-470
lines changed

Some content is hidden

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

84 files changed

+1837
-470
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionModuleCheckTaskProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public class InternalDistributionModuleCheckTaskProvider {
5959
"org.elasticsearch.nativeaccess",
6060
"org.elasticsearch.plugin",
6161
"org.elasticsearch.plugin.analysis",
62-
"org.elasticsearch.pluginclassloader",
6362
"org.elasticsearch.securesm",
6463
"org.elasticsearch.server",
6564
"org.elasticsearch.simdvec",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### Entitlement Agent
2+
3+
This is a java agent that instruments sensitive class library methods with calls into the `entitlement-runtime` module to check for permissions granted under the _entitlements_ system.
4+
5+
The entitlements system provides an alternative to the legacy `SecurityManager` system, which is deprecated for removal.
6+
With this agent, the Elasticsearch server can retain some control over which class library methods can be invoked by which callers.
7+
8+
This module is responsible for inserting the appropriate bytecode to achieve enforcement of the rules governed by the `entitlement-runtime` module.
9+
10+
It is not responsible for permission granting or checking logic. That responsibility lies with `entitlement-runtime`.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
apply plugin: 'elasticsearch.build'
11+
12+
configurations {
13+
entitlementRuntime
14+
}
15+
16+
dependencies {
17+
entitlementRuntime project(":libs:elasticsearch-entitlement-runtime")
18+
implementation project(":libs:elasticsearch-entitlement-runtime")
19+
testImplementation project(":test:framework")
20+
}
21+
22+
tasks.named('test').configure {
23+
dependsOn('jar')
24+
jvmArgs "-javaagent:${ tasks.named('jar').flatMap{ it.archiveFile }.get()}"
25+
}
26+
27+
tasks.named('jar').configure {
28+
manifest {
29+
attributes(
30+
'Premain-Class': 'org.elasticsearch.entitlement.agent.EntitlementAgent'
31+
, 'Can-Retransform-Classes': 'true'
32+
)
33+
}
34+
}
35+
36+
tasks.named('forbiddenApisMain').configure {
37+
replaceSignatureFiles 'jdk-signatures'
38+
}
39+

libs/plugin-classloader/src/main/java/module-info.java renamed to distribution/tools/entitlement-agent/src/main/java/module-info.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
module org.elasticsearch.pluginclassloader {
11-
exports org.elasticsearch.plugins.loader;
10+
module org.elasticsearch.entitlement.agent {
11+
requires java.instrument;
12+
requires org.elasticsearch.entitlement.runtime;
1213
}

server/src/main/java/org/elasticsearch/cluster/ack/AckedRequest.java renamed to distribution/tools/entitlement-agent/src/main/java/org/elasticsearch/entitlement/agent/EntitlementAgent.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,15 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
package org.elasticsearch.cluster.ack;
10+
package org.elasticsearch.entitlement.agent;
1111

12-
import org.elasticsearch.core.TimeValue;
12+
import org.elasticsearch.entitlement.runtime.api.EntitlementChecks;
1313

14-
/**
15-
* Identifies a cluster state update request with acknowledgement support
16-
*/
17-
public interface AckedRequest {
14+
import java.lang.instrument.Instrumentation;
1815

19-
/**
20-
* Returns the acknowledgement timeout
21-
*/
22-
TimeValue ackTimeout();
16+
public class EntitlementAgent {
2317

24-
/**
25-
* Returns the timeout for the request to be completed on the master node
26-
*/
27-
TimeValue masterNodeTimeout();
18+
public static void premain(String agentArgs, Instrumentation inst) throws Exception {
19+
EntitlementChecks.setAgentBooted();
20+
}
2821
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
package org.elasticsearch.entitlement.agent;
11+
12+
import org.elasticsearch.entitlement.runtime.api.EntitlementChecks;
13+
import org.elasticsearch.test.ESTestCase;
14+
import org.elasticsearch.test.ESTestCase.WithoutSecurityManager;
15+
16+
/**
17+
* This is an end-to-end test that runs with the javaagent installed.
18+
* It should exhaustively test every instrumented method to make sure it passes with the entitlement
19+
* and fails without it.
20+
* See {@code build.gradle} for how we set the command line arguments for this test.
21+
*/
22+
@WithoutSecurityManager
23+
public class EntitlementAgentTests extends ESTestCase {
24+
25+
public void testAgentBooted() {
26+
assertTrue(EntitlementChecks.isAgentBooted());
27+
}
28+
29+
}

docs/changelog/112768.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 112768
2+
summary: Deduplicate Kuromoji User Dictionary
3+
area: Search
4+
type: enhancement
5+
issues: []

docs/changelog/113102.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 113102
2+
summary: Trigger merges after recovery
3+
area: Recovery
4+
type: enhancement
5+
issues: []

docs/changelog/113103.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 113103
2+
summary: "ESQL: Align year diffing to the rest of the units in DATE_DIFF: chronological"
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 112482

docs/plugins/analysis-kuromoji.asciidoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ unknown words. It can be set to:
133133

134134
Whether punctuation should be discarded from the output. Defaults to `true`.
135135

136+
`lenient`::
137+
138+
Whether the `user_dictionary` should be deduplicated on the provided `text`.
139+
False by default causing duplicates to generate an error.
140+
136141
`user_dictionary`::
137142
+
138143
--
@@ -221,7 +226,8 @@ PUT kuromoji_sample
221226
"type": "kuromoji_tokenizer",
222227
"mode": "extended",
223228
"discard_punctuation": "false",
224-
"user_dictionary": "userdict_ja.txt"
229+
"user_dictionary": "userdict_ja.txt",
230+
"lenient": "true"
225231
}
226232
},
227233
"analyzer": {

0 commit comments

Comments
 (0)