Skip to content

Commit

Permalink
Make GetTermVersionAction internal
Browse files Browse the repository at this point in the history
GetTermVersion action has been added to check if cluster state needs to
be updated as a performance improvement on all cluster state checks.
The Authorization systems in the Security Plugin check all actions that
do not start with `internal:` for permissions causing users without
`cluster:monitor/*` permissions to start getting 403 exceptions.

This change signals that this action does not require an authorization
check by any security systems since it cannot be called via REST APIs.

Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Mar 22, 2024
1 parent c04dad5 commit f1cd937
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class GetTermVersionAction extends ActionType<GetTermVersionResponse> {

public static final GetTermVersionAction INSTANCE = new GetTermVersionAction();
public static final String NAME = "cluster:monitor/term";
public static final String NAME = "internal:monitor/term";

private GetTermVersionAction() {
super(NAME, GetTermVersionResponse::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public void testTermCheckMatchWithClusterManager() throws ExecutionException, In
assertThat(transport.capturedRequests().length, equalTo(1));
CapturingTransport.CapturedRequest capturedRequest = transport.capturedRequests()[0];
assertTrue(capturedRequest.node.isClusterManagerNode());
assertThat(capturedRequest.action, equalTo("cluster:monitor/term"));
assertThat(capturedRequest.action, equalTo("internal:monitor/term"));
GetTermVersionResponse response = new GetTermVersionResponse(
new ClusterStateTermVersion(
clusterService.state().getClusterName(),
Expand All @@ -249,7 +249,7 @@ public void testTermCheckNoMatchWithClusterManager() throws ExecutionException,
assertThat(transport.capturedRequests().length, equalTo(1));
CapturingTransport.CapturedRequest termCheckRequest = transport.capturedRequests()[0];
assertTrue(termCheckRequest.node.isClusterManagerNode());
assertThat(termCheckRequest.action, equalTo("cluster:monitor/term"));
assertThat(termCheckRequest.action, equalTo("internal:monitor/term"));
GetTermVersionResponse noMatchResponse = new GetTermVersionResponse(
new ClusterStateTermVersion(
clusterService.state().getClusterName(),
Expand Down

0 comments on commit f1cd937

Please sign in to comment.