Skip to content

Commit

Permalink
not allowing index starting with . for replication
Browse files Browse the repository at this point in the history
Signed-off-by: naveen pajjuri <[email protected]>
  • Loading branch information
naveen pajjuri committed Jul 15, 2021
1 parent 779ee64 commit 9d243af
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.elasticsearch.action.support.master.AcknowledgedResponse
import org.elasticsearch.client.Client
import org.elasticsearch.common.inject.Inject
import org.elasticsearch.common.util.concurrent.ThreadContext
import org.elasticsearch.indices.InvalidIndexNameException
import org.elasticsearch.tasks.Task
import org.elasticsearch.threadpool.ThreadPool
import org.elasticsearch.transport.TransportService
Expand All @@ -54,6 +55,9 @@ class TransportReplicateIndexAction @Inject constructor(transportService: Transp
val user = SecurityContext.fromSecurityThreadContext(threadPool.threadContext)
launch(threadPool.coroutineContext()) {
listener.completeWith {
if(request.remoteIndex.startsWith(".")) {
throw InvalidIndexNameException(request.remoteIndex,"Cannot start replication for an index starting with '.'")
}
val remoteClient = client.getRemoteClusterClient(request.remoteCluster)
val getSettingsRequest = GetSettingsRequest().includeDefaults(false).indices(request.remoteIndex)
val settingsResponse = remoteClient.suspending(remoteClient.admin().indices()::getSettings, injectSecurityContext = true)(getSettingsRequest)
Expand Down

0 comments on commit 9d243af

Please sign in to comment.