Skip to content

Commit

Permalink
Refactor the cluster permission filter of service accounts
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 committed Oct 26, 2023
1 parent 12c60fe commit 04c96d5
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,14 @@ public PrivilegesEvaluatorResponse evaluate(
namedXContentRegistry
);

if (isClusterPerm(action0) && isServiceAccount(user)) {
presponse.allowed = false;
log.info("{} is a service account which as no access to cluster level permission of {}.", user, action0);
return presponse;
}

if (isClusterPerm(action0)) {
if (isServiceAccount(user)) {
presponse.missingPrivileges.add(action0);
presponse.allowed = false;
log.info("{} is a service account which as no access to cluster level permission of {}.", user, action0);
return presponse;
}

if (!securityRoles.impliesClusterPermissionPermission(action0)) {
presponse.missingPrivileges.add(action0);
presponse.allowed = false;
Expand Down

0 comments on commit 04c96d5

Please sign in to comment.