Skip to content

Commit 85eaf61

Browse files
skip auditing only for InvalidIndexNameException
1 parent 7037533 commit 85eaf61

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ private void authorizeAction(
503503
indicesAndAliasesResolver.resolve(action, request, projectMetadata, authorizedIndices)
504504
),
505505
e -> {
506-
if (e instanceof IndexNotFoundException || e instanceof InvalidIndexNameException) {
506+
if (e instanceof InvalidIndexNameException) {
507507
logger.debug(
508508
() -> Strings.format(
509509
"failed [%s] action authorization for [%s] due [%s] exception",
@@ -514,8 +514,12 @@ private void authorizeAction(
514514
e
515515
);
516516
listener.onFailure(e);
517+
return;
518+
}
519+
auditTrail.accessDenied(requestId, authentication, action, request, authzInfo);
520+
if (e instanceof IndexNotFoundException) {
521+
listener.onFailure(e);
517522
} else {
518-
auditTrail.accessDenied(requestId, authentication, action, request, authzInfo);
519523
listener.onFailure(actionDenied(authentication, authzInfo, action, request, e));
520524
}
521525
}

0 commit comments

Comments
 (0)