Skip to content

Conversation

@opauloh
Copy link
Contributor

@opauloh opauloh commented Jun 18, 2025

Summary

Currently, the editor and viewer built-in roles do not contain the appropriate Entity Store and Asset Criticality index privileges for Security users.

This PR updates the index privileges to include the .entities.v1.latest.security* and .asset-criticality.asset-criticality-* indices with the appropriate permission:

Viewer

  • Read .entities.v1.latest.security*
  • Read .asset-criticality.asset-criticality-*

Editor

  • Read .entities.v1.latest.security* (Users don't write directly at entity store indices)
  • Write .asset-criticality.asset-criticality-*

Kibana system

  • Write `.entities.v1.latest.security*

@opauloh opauloh requested a review from a team as a code owner June 18, 2025 19:49
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.1.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Jun 18, 2025
@opauloh opauloh added Team:Security Meta label for security team and removed needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team v9.1.0 labels Jun 18, 2025
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label and removed Team:Security Meta label for security team labels Jun 18, 2025
@opauloh opauloh added >enhancement v9.1.0 :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC labels Jun 18, 2025
@elasticsearchmachine elasticsearchmachine added Team:Security Meta label for security team and removed needs:triage Requires assignment of a team area label labels Jun 18, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @opauloh, I've created a changelog YAML for you.

Copy link
Contributor

@richard-dennehy richard-dennehy left a comment

Choose a reason for hiding this comment

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

Could we have a little more context on this?

This appears to grant access to all security entities and asset criticality indices across all spaces, is this definitely what we want?

Does this need to go into 9.1? The feature freeze is today

// Security - Entity Store is view only
RoleDescriptor.IndicesPrivileges.builder()
.indices(ReservedRolesStore.ENTITY_STORE_V1_LATEST_INDEX)
.privileges("read", "view_index_metadata")
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to double check - Serverless Editor appears to have write access to these indices - is this difference intentional?

Copy link
Contributor Author

@opauloh opauloh Jun 24, 2025

Choose a reason for hiding this comment

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

Thanks for bringing it to my attention!

I will tag @hop-dev and @jaredburgettelastic to help on that. Mark / Jared, from what I could see, users don't really need to write directly into the Entity Store index, but do you happen to know a use case where they would need? Like running the API to clean the Entity Store or something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

No I think this was a mistake in the original PR apologies!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for confirming @hop-dev, so @richard-dennehy, the changes on this PR are correct, we will follow up on reducing the extra permissions on Serverless editor role to keep it consistent!

Copy link
Contributor

Choose a reason for hiding this comment

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

@opauloh sorry I have just thought, because the transform runs as the user who enabled the entity store, I believe we do need write permissions? Have I got that wrong?

Copy link
Contributor Author

@opauloh opauloh Jul 3, 2025

Choose a reason for hiding this comment

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

I initially thought the same, but it turns out the Transform API doesn't require write privilege.

Required authorization
Index privileges: create_index,read,index,view_index_metadata
Cluster privileges: manage_transform

I guess the rationale behind this is that users shouldn't be writing to the transform destination indices directly anyway?


That's also accurate with the Entity Store permission page. (No write access required to the .entities.v1.latest.* index)

Also, by design, Editors wouldn't have the "manage" privilege, so Editors users won't likely be the ones to enable Entity Store / Asset Inventory, unless extra permissions are granted:

I.e screenshot from the permissions screen when accessing the Entity Store with an Editor user:

image

However, editors should be able to read entity store data and update asset criticality once it's enabled.


The only use case I can imagine writing directly would be handy is, if we had to update data directly on the destination index using the user permission to update data without waiting for the transforms to run, however, I didn't find anything performing that operation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the detailed investigation, that's interesting about the transform write permissions! 👍

@opauloh
Copy link
Contributor Author

opauloh commented Jun 24, 2025

Could we have a little more context on this?

This appears to grant access to all security entities and asset criticality indices across all spaces, is this definitely what we want?

Yes, the Entity Store and Asset Inventory features are cross-space functionality, and built-in roles should have access to them as they have the Kibana "All spaces" permission by default.

Does this need to go into 9.1? The feature freeze is today

Not necessarily, the main reason to include it now was to grant users less friction access to the new "Asset Inventory" feature in Kibana that's releasing on 9.1, which relies on Asset Criticality and Entity Store that were released in previous versions, however, since Inventory will be in Technical Preview for 9.1 is not mandatory to include the permissions, but it will be for 9.2 when the "Asset Inventory" features goes GA.

@opauloh opauloh added v9.2.0 and removed v9.1.0 labels Jun 25, 2025
opauloh and others added 2 commits June 30, 2025 11:35
Updates the entity store index pattern to ensure it matches the minimum necessary index name and narrow it down to the correct use case
@opauloh opauloh requested a review from richard-dennehy June 30, 2025 18:44
@opauloh opauloh enabled auto-merge (squash) July 30, 2025 01:09
opauloh and others added 2 commits July 29, 2025 19:21
Modifies the reserved role descriptor to allow all privileges on the entities index.

Adds a test to verify that the entities index has all access allowed.
@opauloh opauloh requested a review from a team as a code owner July 30, 2025 02:40
@opauloh opauloh changed the title [Security] Add entity store and asset criticality index privileges to built in Editor and Viewer roles [Security] Add entity store and asset criticality index privileges to built in roles Jul 30, 2025
Corrects a typo in a test case by replacing `Array` with `Arrays`, ensuring the test functions as intended.
@kc13greiner
Copy link
Contributor

Heya @opauloh !

I see you're changing the kibana_system user's privileges on .entities.v1.latest.security from read to all

Just a couple questions:

  • Can you provide additional context about "the editor and viewer built-in roles" but not why the kibana_system user's roles need to be updated?
  • Is all absolutely necessary? Is there a subset of privileges granted by all that will work instead?

@kc13greiner kc13greiner self-requested a review July 30, 2025 14:17
@opauloh
Copy link
Contributor Author

opauloh commented Jul 30, 2025

Hi @kc13greiner, thanks for those questions

Can you provide additional context about "the editor and viewer built-in roles" but not why the kibana_system user's roles need to be updated?

Sure, I will use the user Entity store to exemplify. User entity store source it's data from multiple indices, which are processed by a pivot transform where outputs the aggregated data into the final index .entities.v1.latest.security_user_default.

image

In this scenario, Editor users of the Entity Store experience wants to have the ability to change the Criticality and Risk scoring, and for this it's needed write permission to the risk-score.risk-score-latest-default and .asset-criticality.asset-criticality-default. Write permission in the .entities.v1.latest.security_user_default index is not needed and even discouraged for the user, since the transform will take care of updating the final index once the transform is processed.

Why add 'write' permission to the `.entities.v1.latest.security index to the Kibana System and not to Editor / Viewer?*

We started to improve the UX for the users, users visualize data directly from .entities.v1.latest.security_user_default, so as you can imagine, changing some field, i.e (Asset Criticality) and having to wait for a couple of minutes to see this update reflected in the interface is not ideal. The solution we came up with is that, once the asset_criticality API successfully creates/update/delete a record in the .asset-criticality.asset-criticality-default index, it will also be responsible for updating the record directly in the final index (.entities.v1.latest.security_user_default). Our conclusion is that updating the final index should be considered an internal operation, so users still keep the granular control when creating roles with write access. For example, a user who only needs to change Asset Criticality will require only write permission for .asset-criticality; they shouldn't need to have write permission to the .entities.v1.latest.security_user_default for that purpose.

Is all absolutely necessary? Is there a subset of privileges granted by all that will work instead?

Good point! After reviewing it, all we need for the mentioned improvement is to add "write" permission on top of the "read" permission, I will update it accordingly, the idea of granting "all" was to prepare for future use cases that are in discussion like migration and backfilling of Entity Store data, this means we will surely need extra permissions when the time comes, but unlike the use case above we don't know exactly when, so I agree it's a safer choice to add more permissions as needed and only the exact required permissions.

opauloh and others added 4 commits July 30, 2025 15:46
Reduces the privileges granted to the Kibana owned reserved role for the .entities indices to only read and write. This change restricts the role from having "all" privileges, enhancing security.
@opauloh opauloh merged commit aa58fc7 into elastic:main Jul 31, 2025
39 checks passed
@opauloh
Copy link
Contributor Author

opauloh commented Jul 31, 2025

cc @kc13greiner, forgot I had auto-merged enabled, so it merged as soon as I updated the permission. Let me know if everything is clear

afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Jul 31, 2025
… built in Editor and Viewer roles (elastic#129662)

* Adding asset criticality and entity store permissions to built in roles

* Update docs/changelog/129662.yaml

* [CI] Auto commit changes from spotless

* Corrects entity store index pattern

Updates the entity store index pattern to ensure it matches the minimum necessary index name and narrow it down to the correct use case

---------

Co-authored-by: elasticsearchmachine <[email protected]>
@kc13greiner
Copy link
Contributor

@opauloh

Thank you for the excellent overview! I agree that it makes sense in this case to add write on that system index.

And thanks for dialing back all to write! That is much preferred from a security standpoint 🚀

LGTM!

smalyshev pushed a commit to smalyshev/elasticsearch that referenced this pull request Jul 31, 2025
… built in Editor and Viewer roles (elastic#129662)

* Adding asset criticality and entity store permissions to built in roles

* Update docs/changelog/129662.yaml

* [CI] Auto commit changes from spotless

* Corrects entity store index pattern

Updates the entity store index pattern to ensure it matches the minimum necessary index name and narrow it down to the correct use case

---------

Co-authored-by: elasticsearchmachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants