Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move GetCheckpointAction under the monitor namespace #84473

Merged

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Mar 1, 2022

In #80984, a new GetCheckpointAction is added under the namespace of
indices:internal/. This is a new namespace and there it is not automatically
covered by the manage index privilege. Since it is explicilty added to
view_index_metadata, it means view_index_metadata is no longer a
subset of manage. This is unexpected.

After discussion, instead of adding this new namespace to manage, we agreed
to move the new action under monitor and drop the new namespace.
IIUC, the internal is used to indicate that this action is internal to a bigger process
and it cannot be called on its own and should be kept as an implementation detail.
However, what privilege an action should have is an orthogonal concern to how it
should be used. The function of this action is more of monitor (similar to the existing
GetGlobalCheckpoint API)

This PR also adds a few tests to ensure certain subset relationships between
privileges, e.g. "view_index_privilege" is a subset of "manage".

In elastic#80984, a new action is added to the "view_index_privilege" index
privilege. This PR adds it under "manage" as well and also adds test to
ensure "view_index_metadata" is always a subset of "manage".
@ywangd ywangd added >non-issue :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC v8.2.0 labels Mar 1, 2022
@ywangd ywangd requested a review from tvernum March 1, 2022 03:33
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Mar 1, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@ywangd ywangd changed the title Ensure view_index_metadata is fully covered by manage Move GetCheckpointAction under the monitor namespace Mar 1, 2022
@ywangd
Copy link
Member Author

ywangd commented Mar 1, 2022

I kept the explicit grant of GetCheckpointAction to view_index_metadata because I believe ML currently already requires view_index_metadata for relevant process and there is no intention to change that for the time being. @hendrikmuhs Please feel free to correct me. Thanks!

@ywangd ywangd requested a review from hendrikmuhs March 1, 2022 04:42
@ywangd
Copy link
Member Author

ywangd commented Mar 1, 2022

The test failure is unrelated. It does not even have security enabled.

@hendrikmuhs
Copy link
Contributor

I kept the explicit grant of GetCheckpointAction to view_index_metadata because I believe ML currently already requires view_index_metadata for relevant process and there is no intention to change that for the time being. @hendrikmuhs Please feel free to correct me. Thanks!

Yes, that's correct.

Copy link
Contributor

@hendrikmuhs hendrikmuhs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

However, I am asking you to add documentation to the code, e.g. in Constants.java you could add a code doc header explaining the different namespaces and purposes. Although this is test code, every new action has to be added here, so a developer would automatically stumble upon this documentation (or you find a better place and link it, whatever). Your explanations in the PR are great, but will be lost.

Comment on lines +55 to +67
/**
* The name of an index related action always being with `indices:` followed by a sequence of slash-separated terms
* that generally describes the hierarchy (from broader to more specific) of the action. For example, the
* first level comprises `admin`, `monitor`, `data` which generally categorize an action into either an admin
* related function, or a monitoring related function or a user-data related function. Subsequent levels further
* narrow down the category until the meaning is specific enough.
*
* Note that these terms are meant to categorize what the action does, *not* how it should be invoked. This means
* whether an action is accessible via REST API should not contribute to its naming.
*
* Also note that the `internal:transport/proxy/` prefix is automatically added and stripped for actions that go
* through a CCR/CCS proxy. No action should be explicitly named like that.
*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I am asking you to add documentation to the code, e.g. in Constants.java you could add a code doc header explaining the different namespaces and purposes. Although this is test code, every new action has to be added here, so a developer would automatically stumble upon this documentation (or you find a better place and link it, whatever). Your explanations in the PR are great, but will be lost.

@hendrikmuhs I added this comment to IndexPrivilege. I hope this read right to you and potentially be useful in future. Thanks!

@ywangd ywangd merged commit 5c36498 into elastic:master Mar 9, 2022
albertzaharovits pushed a commit to albertzaharovits/elasticsearch that referenced this pull request Mar 9, 2022
In elastic#80984, a new GetCheckpointAction is added under the namespace of
indices:internal/. This is a new namespace and there it is not automatically
covered by the manage index privilege. Since it is explicilty added to
view_index_metadata, it means view_index_metadata is no longer a
subset of manage. This is unexpected.

After discussion, instead of adding this new namespace to manage, we agreed
to move the new action under monitor and drop the new namespace.
IIUC, the internal is used to indicate that this action is internal to a bigger process
and it cannot be called on its own and should be kept as an implementation detail.
However, what privilege an action should have is an orthogonal concern to how it
should be used. The function of this action is more of monitor (similar to the existing
GetGlobalCheckpoint API)

This PR also adds a few tests to ensure certain subset relationships between
privileges, e.g. "view_index_privilege" is a subset of "manage".
javanna pushed a commit to javanna/elasticsearch that referenced this pull request Mar 16, 2022
In elastic#80984, a new GetCheckpointAction is added under the namespace of
indices:internal/. This is a new namespace and there it is not automatically
covered by the manage index privilege. Since it is explicilty added to
view_index_metadata, it means view_index_metadata is no longer a
subset of manage. This is unexpected.

After discussion, instead of adding this new namespace to manage, we agreed
to move the new action under monitor and drop the new namespace.
IIUC, the internal is used to indicate that this action is internal to a bigger process
and it cannot be called on its own and should be kept as an implementation detail.
However, what privilege an action should have is an orthogonal concern to how it
should be used. The function of this action is more of monitor (similar to the existing
GetGlobalCheckpoint API)

This PR also adds a few tests to ensure certain subset relationships between
privileges, e.g. "view_index_privilege" is a subset of "manage".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants