Skip to content

Commit ef0417d

Browse files
extend shouldExcludeLocalResolution check
1 parent 7812375 commit ef0417d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/IndicesAndAliasesResolver.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,7 @@ ResolvedIndices resolveIndicesAndAliases(
342342
// Always parse selectors, but do so lazily so that we don't spend a lot of time splitting strings each resolution
343343
isAllIndices = IndexNameExpressionResolver.isAllIndices(indicesList(indicesRequest.indices()), (expr) -> {
344344
var unprefixed = crossProjectModeDecider.resolvesCrossProject(replaceable)
345-
? CrossProjectIndexExpressionsRewriter.rewriteIndexExpression(
346-
expr,
347-
authorizedProjects.originProjectAlias(),
348-
authorizedProjects.allProjectAliases()
349-
).localExpression()
345+
? RemoteClusterAware.splitIndexName(expr)[1]
350346
: expr;
351347
return unprefixed != null ? IndexNameExpressionResolver.splitSelectorExpression(unprefixed).v1() : null;
352348
});
@@ -400,12 +396,13 @@ ResolvedIndices resolveIndicesAndAliases(
400396
replaceable.getProjectRouting(),
401397
authorizedProjects
402398
);
403-
remoteIndices = CrossProjectIndexExpressionsRewriter.rewriteIndexExpression(
399+
final var expr = CrossProjectIndexExpressionsRewriter.rewriteIndexExpression(
404400
indexExpression,
405401
resolvedProjects.originProjectAlias(),
406402
resolvedProjects.allProjectAliases()
407-
).remoteExpressions();
408-
if (resolvedProjects.originProject() == null) {
403+
);
404+
remoteIndices = expr.remoteExpressions();
405+
if (resolvedProjects.originProject() == null || expr.localExpression() == null) {
409406
shouldExcludeLocalResolution = true;
410407
}
411408
}

0 commit comments

Comments
 (0)