Skip to content

Commit 20b2c76

Browse files
committed
Merge remote-tracking branch 'upstream/main' into reranking-failure-response
2 parents 3788429 + 27b8fd7 commit 20b2c76

File tree

107 files changed

+2994
-3049
lines changed

Some content is hidden

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

107 files changed

+2994
-3049
lines changed

docs/changelog/123085.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 123085
2+
summary: Remove duplicated nested commands
3+
area: ES|QL
4+
type: bug
5+
issues: []

libs/entitlement/bridge/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
module org.elasticsearch.entitlement.bridge {
1313
requires java.net.http;
1414
requires jdk.net;
15+
requires java.logging;
1516

1617
exports org.elasticsearch.entitlement.bridge;
1718
}

libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
import java.util.concurrent.ForkJoinPool;
8989
import java.util.function.BiPredicate;
9090
import java.util.function.Consumer;
91+
import java.util.logging.FileHandler;
9192

9293
import javax.net.ssl.HostnameVerifier;
9394
import javax.net.ssl.HttpsURLConnection;
@@ -882,9 +883,34 @@ public interface EntitlementChecker {
882883

883884
void check$java_nio_file_Files$$lines(Class<?> callerClass, Path path);
884885

885-
// file system providers
886886
void check$java_nio_file_spi_FileSystemProvider$(Class<?> callerClass);
887887

888+
void check$java_util_logging_FileHandler$(Class<?> callerClass);
889+
890+
void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern);
891+
892+
void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, boolean append);
893+
894+
void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, int limit, int count);
895+
896+
void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, int limit, int count, boolean append);
897+
898+
void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, long limit, int count, boolean append);
899+
900+
void check$java_util_logging_FileHandler$close(Class<?> callerClass, FileHandler that);
901+
902+
void check$java_net_http_HttpRequest$BodyPublishers$$ofFile(Class<?> callerClass, Path path);
903+
904+
void check$java_net_http_HttpResponse$BodyHandlers$$ofFile(Class<?> callerClass, Path path);
905+
906+
void check$java_net_http_HttpResponse$BodyHandlers$$ofFile(Class<?> callerClass, Path path, OpenOption... options);
907+
908+
void check$java_net_http_HttpResponse$BodyHandlers$$ofFileDownload(Class<?> callerClass, Path directory, OpenOption... openOptions);
909+
910+
void check$java_net_http_HttpResponse$BodySubscribers$$ofFile(Class<?> callerClass, Path directory);
911+
912+
void check$java_net_http_HttpResponse$BodySubscribers$$ofFile(Class<?> callerClass, Path directory, OpenOption... openOptions);
913+
888914
void checkNewFileSystem(Class<?> callerClass, FileSystemProvider that, URI uri, Map<String, ?> env);
889915

890916
void checkNewFileSystem(Class<?> callerClass, FileSystemProvider that, Path path, Map<String, ?> env);

libs/entitlement/qa/entitled-plugin/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
requires org.elasticsearch.entitlement;
1313
requires org.elasticsearch.base; // SuppressForbidden
1414
requires org.elasticsearch.logging;
15+
requires java.logging;
1516

1617
exports org.elasticsearch.entitlement.qa.entitled; // Must be unqualified so non-modular IT tests can call us
1718
}

libs/entitlement/qa/entitlement-test-plugin/src/main/java/org/elasticsearch/entitlement/qa/test/FileCheckActions.java

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@
2222
import java.io.FileWriter;
2323
import java.io.IOException;
2424
import java.io.RandomAccessFile;
25+
import java.net.http.HttpRequest;
26+
import java.net.http.HttpResponse;
2527
import java.nio.charset.StandardCharsets;
2628
import java.nio.file.Path;
2729
import java.nio.file.Paths;
2830
import java.security.GeneralSecurityException;
2931
import java.security.KeyStore;
3032
import java.util.Scanner;
3133
import java.util.jar.JarFile;
34+
import java.util.logging.FileHandler;
3235
import java.util.zip.ZipException;
3336
import java.util.zip.ZipFile;
3437

3538
import static java.nio.charset.Charset.defaultCharset;
39+
import static java.nio.file.StandardOpenOption.CREATE;
40+
import static java.nio.file.StandardOpenOption.WRITE;
3641
import static java.util.zip.ZipFile.OPEN_DELETE;
3742
import static java.util.zip.ZipFile.OPEN_READ;
3843
import static org.elasticsearch.entitlement.qa.entitled.EntitledActions.createTempFileForWrite;
@@ -477,5 +482,86 @@ static void createScannerFileWithCharsetName() throws FileNotFoundException {
477482
new Scanner(readFile().toFile(), "UTF-8");
478483
}
479484

485+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
486+
static void fileHandler() throws IOException {
487+
new FileHandler();
488+
}
489+
490+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
491+
static void fileHandler_String() throws IOException {
492+
new FileHandler(readFile().toString());
493+
}
494+
495+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
496+
static void fileHandler_StringBoolean() throws IOException {
497+
new FileHandler(readFile().toString(), false);
498+
}
499+
500+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
501+
static void fileHandler_StringIntInt() throws IOException {
502+
new FileHandler(readFile().toString(), 1, 2);
503+
}
504+
505+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
506+
static void fileHandler_StringIntIntBoolean() throws IOException {
507+
new FileHandler(readFile().toString(), 1, 2, false);
508+
}
509+
510+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
511+
static void fileHandler_StringLongIntBoolean() throws IOException {
512+
new FileHandler(readFile().toString(), 1L, 2, false);
513+
}
514+
515+
@EntitlementTest(expectedAccess = PLUGINS)
516+
static void httpRequestBodyPublishersOfFile() throws IOException {
517+
HttpRequest.BodyPublishers.ofFile(readFile());
518+
}
519+
520+
@EntitlementTest(expectedAccess = PLUGINS)
521+
static void httpResponseBodyHandlersOfFile() {
522+
HttpResponse.BodyHandlers.ofFile(readWriteFile());
523+
}
524+
525+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
526+
static void httpResponseBodyHandlersOfFile_readOnly() {
527+
HttpResponse.BodyHandlers.ofFile(readFile());
528+
}
529+
530+
@EntitlementTest(expectedAccess = PLUGINS)
531+
static void httpResponseBodyHandlersOfFileDownload() {
532+
HttpResponse.BodyHandlers.ofFileDownload(readWriteDir());
533+
}
534+
535+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
536+
static void httpResponseBodyHandlersOfFileDownload_readOnly() {
537+
HttpResponse.BodyHandlers.ofFileDownload(readDir());
538+
}
539+
540+
@EntitlementTest(expectedAccess = PLUGINS)
541+
static void httpResponseBodySubscribersOfFile_File() {
542+
HttpResponse.BodySubscribers.ofFile(readWriteFile());
543+
}
544+
545+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
546+
static void httpResponseBodySubscribersOfFile_File_readOnly() {
547+
HttpResponse.BodySubscribers.ofFile(readFile());
548+
}
549+
550+
@EntitlementTest(expectedAccess = PLUGINS)
551+
static void httpResponseBodySubscribersOfFile_FileOpenOptions() {
552+
// Note that, unlike other methods like BodyHandlers.ofFile, this is indeed
553+
// an overload distinct from ofFile with no OpenOptions, and so it needs its
554+
// own instrumentation and its own test.
555+
HttpResponse.BodySubscribers.ofFile(readWriteFile(), CREATE, WRITE);
556+
}
557+
558+
@EntitlementTest(expectedAccess = ALWAYS_DENIED)
559+
static void httpResponseBodySubscribersOfFile_FileOpenOptions_readOnly() {
560+
// Note that, unlike other methods like BodyHandlers.ofFile, this is indeed
561+
// an overload distinct from ofFile with no OpenOptions, and so it needs its
562+
// own instrumentation and its own test.
563+
HttpResponse.BodySubscribers.ofFile(readFile(), CREATE, WRITE);
564+
}
565+
480566
private FileCheckActions() {}
481567
}

libs/entitlement/src/main/java/module-info.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
*/
99

1010
module org.elasticsearch.entitlement {
11+
requires org.elasticsearch.base;
1112
requires org.elasticsearch.xcontent;
1213
requires org.elasticsearch.logging;
1314
requires java.instrument;
14-
requires org.elasticsearch.base;
15-
requires jdk.attach;
15+
requires java.logging;
1616
requires java.net.http;
17+
requires jdk.attach;
1718
requires jdk.net;
1819

1920
requires static org.elasticsearch.entitlement.bridge; // At runtime, this will be in java.base

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
import java.util.concurrent.ForkJoinPool;
9898
import java.util.function.BiPredicate;
9999
import java.util.function.Consumer;
100+
import java.util.logging.FileHandler;
100101

101102
import javax.net.ssl.HostnameVerifier;
102103
import javax.net.ssl.HttpsURLConnection;
@@ -1845,6 +1846,78 @@ public void checkSelectorProviderInheritedChannel(Class<?> callerClass, Selector
18451846
policyManager.checkChangeJVMGlobalState(callerClass);
18461847
}
18471848

1849+
@Override
1850+
public void check$java_util_logging_FileHandler$(Class<?> callerClass) {
1851+
policyManager.checkLoggingFileHandler(callerClass);
1852+
}
1853+
1854+
@Override
1855+
public void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern) {
1856+
policyManager.checkLoggingFileHandler(callerClass);
1857+
}
1858+
1859+
@Override
1860+
public void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, boolean append) {
1861+
policyManager.checkLoggingFileHandler(callerClass);
1862+
}
1863+
1864+
@Override
1865+
public void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, int limit, int count) {
1866+
policyManager.checkLoggingFileHandler(callerClass);
1867+
}
1868+
1869+
@Override
1870+
public void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, int limit, int count, boolean append) {
1871+
policyManager.checkLoggingFileHandler(callerClass);
1872+
}
1873+
1874+
@Override
1875+
public void check$java_util_logging_FileHandler$(Class<?> callerClass, String pattern, long limit, int count, boolean append) {
1876+
policyManager.checkLoggingFileHandler(callerClass);
1877+
}
1878+
1879+
@Override
1880+
public void check$java_util_logging_FileHandler$close(Class<?> callerClass, FileHandler that) {
1881+
// Note that there's no IT test for this one, because there's no way to create
1882+
// a FileHandler. However, we have this check just in case someone does manage
1883+
// to get their hands on a FileHandler and uses close() to cause its lock file to be deleted.
1884+
policyManager.checkLoggingFileHandler(callerClass);
1885+
}
1886+
1887+
@Override
1888+
public void check$java_net_http_HttpRequest$BodyPublishers$$ofFile(Class<?> callerClass, Path path) {
1889+
policyManager.checkFileRead(callerClass, path);
1890+
}
1891+
1892+
@Override
1893+
public void check$java_net_http_HttpResponse$BodyHandlers$$ofFile(Class<?> callerClass, Path path) {
1894+
policyManager.checkFileWrite(callerClass, path);
1895+
}
1896+
1897+
@Override
1898+
public void check$java_net_http_HttpResponse$BodyHandlers$$ofFile(Class<?> callerClass, Path path, OpenOption... options) {
1899+
policyManager.checkFileWrite(callerClass, path);
1900+
}
1901+
1902+
@Override
1903+
public void check$java_net_http_HttpResponse$BodyHandlers$$ofFileDownload(
1904+
Class<?> callerClass,
1905+
Path directory,
1906+
OpenOption... openOptions
1907+
) {
1908+
policyManager.checkFileWrite(callerClass, directory);
1909+
}
1910+
1911+
@Override
1912+
public void check$java_net_http_HttpResponse$BodySubscribers$$ofFile(Class<?> callerClass, Path directory) {
1913+
policyManager.checkFileWrite(callerClass, directory);
1914+
}
1915+
1916+
@Override
1917+
public void check$java_net_http_HttpResponse$BodySubscribers$$ofFile(Class<?> callerClass, Path directory, OpenOption... openOptions) {
1918+
policyManager.checkFileWrite(callerClass, directory);
1919+
}
1920+
18481921
@Override
18491922
public void checkNewFileSystem(Class<?> callerClass, FileSystemProvider that, URI uri, Map<String, ?> env) {
18501923
policyManager.checkChangeJVMGlobalState(callerClass);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ public void checkChangeJVMGlobalState(Class<?> callerClass) {
240240
neverEntitled(callerClass, () -> walkStackForCheckMethodName().orElse("change JVM global state"));
241241
}
242242

243+
public void checkLoggingFileHandler(Class<?> callerClass) {
244+
neverEntitled(callerClass, () -> walkStackForCheckMethodName().orElse("create logging file handler"));
245+
}
246+
243247
private Optional<String> walkStackForCheckMethodName() {
244248
// Look up the check$ method to compose an informative error message.
245249
// This way, we don't need to painstakingly describe every individual global-state change.

muted-tests.yml

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -329,72 +329,21 @@ tests:
329329
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
330330
method: test {yaml=reference/troubleshooting/common-issues/disk-usage-exceeded/line_65}
331331
issue: https://github.com/elastic/elasticsearch/issues/123094
332-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
333-
method: test {fork.ForkWithWhereSortAndLimit ASYNC}
334-
issue: https://github.com/elastic/elasticsearch/issues/123096
335-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
336-
method: test {fork.ForkWithCommonPrefilter ASYNC}
337-
issue: https://github.com/elastic/elasticsearch/issues/123097
338-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
339-
method: test {fork.FiveFork SYNC}
340-
issue: https://github.com/elastic/elasticsearch/issues/123098
341-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
342-
method: test {fork.FiveFork ASYNC}
343-
issue: https://github.com/elastic/elasticsearch/issues/123099
344-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
345-
method: test {fork.SimpleFork ASYNC}
346-
issue: https://github.com/elastic/elasticsearch/issues/123100
347332
- class: org.elasticsearch.xpack.esql.action.CrossClusterQueryWithPartialResultsIT
348333
method: testPartialResults
349334
issue: https://github.com/elastic/elasticsearch/issues/123101
350-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
351-
method: test {fork.ForkWithWhereSortAndLimit SYNC}
352-
issue: https://github.com/elastic/elasticsearch/issues/123103
353-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
354-
method: test {fork.SimpleFork SYNC}
355-
issue: https://github.com/elastic/elasticsearch/issues/123104
356-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
357-
method: test {fork.ForkWithWhereSortDescAndLimit SYNC}
358-
issue: https://github.com/elastic/elasticsearch/issues/123107
359-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
360-
method: test {fork.ForkWithWhereSortDescAndLimit ASYNC}
361-
issue: https://github.com/elastic/elasticsearch/issues/123108
362-
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
363-
method: test {fork.ForkWithCommonPrefilter SYNC}
364-
issue: https://github.com/elastic/elasticsearch/issues/123109
365-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
366-
method: test {p0=esql/40_tsdb/to_string aggregate_metric_double}
367-
issue: https://github.com/elastic/elasticsearch/issues/123116
368-
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
369-
method: test {fork.ForkWithCommonPrefilter}
370-
issue: https://github.com/elastic/elasticsearch/issues/123117
371-
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
372-
method: test {fork.SimpleFork}
373-
issue: https://github.com/elastic/elasticsearch/issues/123118
374-
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
375-
method: test {fork.FiveFork}
376-
issue: https://github.com/elastic/elasticsearch/issues/123119
377-
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
378-
method: test {fork.ForkWithWhereSortDescAndLimit}
379-
issue: https://github.com/elastic/elasticsearch/issues/123120
380-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
381-
method: test {p0=esql/46_downsample/Render stats from downsampled index}
382-
issue: https://github.com/elastic/elasticsearch/issues/123122
383-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
384-
method: test {p0=esql/40_unsupported_types/unsupported}
385-
issue: https://github.com/elastic/elasticsearch/issues/123123
386-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
387-
method: test {p0=esql/40_tsdb/render aggregate_metric_double when missing min and max}
388-
issue: https://github.com/elastic/elasticsearch/issues/123124
389335
- class: org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests
390336
method: testBlockLoaderFromRowStrideReader
391337
issue: https://github.com/elastic/elasticsearch/issues/123126
392-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
393-
method: test {p0=esql/40_tsdb/render aggregate_metric_double when missing value}
394-
issue: https://github.com/elastic/elasticsearch/issues/123130
395-
- class: org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT
396-
method: test {fork.ForkWithWhereSortAndLimit}
397-
issue: https://github.com/elastic/elasticsearch/issues/123131
338+
- class: org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests
339+
method: testBlockLoaderFromRowStrideReaderWithSyntheticSource
340+
issue: https://github.com/elastic/elasticsearch/issues/123145
341+
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
342+
method: testStopQueryLocal
343+
issue: https://github.com/elastic/elasticsearch/issues/121672
344+
- class: org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests
345+
method: testBlockLoaderFromColumnReaderWithSyntheticSource
346+
issue: https://github.com/elastic/elasticsearch/issues/123149
398347

399348
# Examples:
400349
#

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ static TransportVersion def(int id) {
187187
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION_90 = def(9_000_0_03);
188188
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION_90 = def(9_000_0_04);
189189
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_9_0 = def(9_000_0_05);
190+
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90 = def(9_000_0_06);
190191
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
191192
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);
192193
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_003_0_00);
@@ -201,7 +202,8 @@ static TransportVersion def(int id) {
201202
public static final TransportVersion REMOVE_REPOSITORY_CONFLICT_MESSAGE = def(9_012_0_00);
202203
public static final TransportVersion RERANKER_FAILURES_ALLOWED = def(9_013_0_00);
203204
public static final TransportVersion VOYAGE_AI_INTEGRATION_ADDED = def(9_014_0_00);
204-
public static final TransportVersion SEARCH_SUBSIDIARY_FAILURES = def(9_015_0_00);
205+
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES = def(9_015_0_00);
206+
public static final TransportVersion SEARCH_SUBSIDIARY_FAILURES = def(9_016_0_00);
205207

206208
/*
207209
* STOP! READ THIS FIRST! No, really,

0 commit comments

Comments
 (0)