Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3607,6 +3607,11 @@
<sha256 value="57d0a9e9286f82f4eaa851125186997f811befce0e2060ff0a15a77f5a9dd9a7" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.javassist" name="javassist" version="3.30.2-GA">
<artifact name="javassist-3.30.2-GA.jar">
<sha256 value="eba37290994b5e4868f3af98ff113f6244a6b099385d9ad46881307d3cb01aaf" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jdom" name="jdom2" version="2.0.6">
<artifact name="jdom2-2.0.6.jar">
<sha256 value="1345f11ba606d15603d6740551a8c21947c0215640770ec67271fe78bea97cf5" origin="Generated by Gradle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;

class FieldCapabilitiesNodeRequest extends ActionRequest implements IndicesRequest {
class FieldCapabilitiesNodeRequest extends ActionRequest implements IndicesRequest.RemoteClusterShardRequest {

private final List<ShardId> shardIds;
private final String[] fields;
Expand Down Expand Up @@ -215,4 +216,9 @@ public int hashCode() {
result = 31 * result + Arrays.hashCode(allowedTypes);
return result;
}

@Override
public Collection<ShardId> shards() {
return shardIds();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
import org.elasticsearch.transport.TransportService;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.function.BiFunction;
Expand Down Expand Up @@ -280,7 +282,7 @@ boolean buildPointInTimeFromSearchResults() {
}
}

private static final class ShardOpenReaderRequest extends TransportRequest implements IndicesRequest {
private static final class ShardOpenReaderRequest extends TransportRequest implements IndicesRequest.RemoteClusterShardRequest {
final ShardId shardId;
final OriginalIndices originalIndices;
final TimeValue keepAlive;
Expand Down Expand Up @@ -319,6 +321,11 @@ public String[] indices() {
public IndicesOptions indicesOptions() {
return originalIndices.indicesOptions();
}

@Override
public Collection<ShardId> shards() {
return List.of(getShardId());
}
}

private static final class ShardOpenReaderResponse extends SearchPhaseResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.elasticsearch.index.shard.ShardId;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

import static org.elasticsearch.action.ValidateActions.addValidationError;
Expand All @@ -28,7 +30,7 @@
/**
* A request that is broadcast to the unpromotable assigned replicas of a primary.
*/
public class BroadcastUnpromotableRequest extends ActionRequest implements IndicesRequest {
public class BroadcastUnpromotableRequest extends ActionRequest implements IndicesRequest.RemoteClusterShardRequest {

/**
* Holds the index shard routing table that will be used by {@link TransportBroadcastUnpromotableAction} to broadcast the requests to
Expand Down Expand Up @@ -105,4 +107,9 @@ public boolean failShardOnError() {
public IndicesOptions indicesOptions() {
return strictSingleIndexNoExpandForbidClosed();
}

@Override
public Collection<ShardId> shards() {
return List.of(shardId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
Expand All @@ -68,7 +69,7 @@
* It provides all the methods that the {@link SearchContext} needs.
* Provides a cache key based on its content that can be used to cache shard level response.
*/
public class ShardSearchRequest extends TransportRequest implements IndicesRequest {
public class ShardSearchRequest extends TransportRequest implements IndicesRequest.RemoteClusterShardRequest {
private final String clusterAlias;
private final ShardId shardId;
private final int shardRequestIndex;
Expand Down Expand Up @@ -573,6 +574,11 @@ public Rewriteable<Rewriteable> getRewriteable() {
return new RequestRewritable(this);
}

@Override
public Collection<ShardId> shards() {
return List.of(shardId);
}

@SuppressWarnings("rawtypes")
static class RequestRewritable implements Rewriteable<Rewriteable> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
import org.elasticsearch.transport.TransportRequest;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;

/**
* Internal terms enum request executed directly against a specific node, querying potentially many
* shards in one request
*/
public class NodeTermsEnumRequest extends TransportRequest implements IndicesRequest {
public class NodeTermsEnumRequest extends TransportRequest implements IndicesRequest.RemoteClusterShardRequest {

private final String field;
private final String string;
Expand Down Expand Up @@ -181,4 +182,9 @@ public IndicesOptions indicesOptions() {
public boolean remove(ShardId shardId) {
return shardIds.remove(shardId);
}

@Override
public Collection<ShardId> shards() {
return shardIds();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
import org.elasticsearch.xpack.esql.session.EsqlConfiguration;

import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;

final class DataNodeRequest extends TransportRequest implements IndicesRequest {
final class DataNodeRequest extends TransportRequest implements IndicesRequest.RemoteClusterShardRequest {
private static final PlanNameRegistry planNameRegistry = new PlanNameRegistry();
private final String sessionId;
private final EsqlConfiguration configuration;
Expand Down Expand Up @@ -140,6 +141,11 @@ List<ShardId> shardIds() {
return shardIds;
}

@Override
public Collection<ShardId> shards() {
return shardIds();
}

/**
* Returns a map from index UUID to alias filters
*/
Expand Down Expand Up @@ -179,4 +185,5 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(sessionId, configuration, clusterAlias, shardIds, aliasFilters, plan);
}

}
14 changes: 14 additions & 0 deletions x-pack/plugin/security/qa/consistency-checks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ apply plugin: 'elasticsearch.standalone-test'

dependencies {

testImplementation "org.reflections:reflections:0.10.2"
testImplementation "org.javassist:javassist:3.30.2-GA"

//while it is possible to place a dependency on all x-pack plugins and modules,
//we will end up with dependency convergence / jar hell issues
//the set here is a best attempt to include all the relevant modules and x-pack plugins
testImplementation(testArtifact(project(xpackModule('core'))))
testImplementation project(path: ':modules:ingest-common')
testImplementation project(path: ':modules:data-streams')
Expand All @@ -25,3 +31,11 @@ dependencies {
testImplementation project(path: xpackModule('slm'))
testImplementation project(path: xpackModule('sql'))
}
tasks.named("test").configure {
//test uses reflections to find classes, so we need to disable the security manager
systemProperty 'tests.security.manager', 'false'
}
tasks.named("forbiddenApisTest") {
//this test intentionally uses reflection to violate java access control
it.enabled = false
}
Loading