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

System indices treated as restricted indices #74212

Merged

Conversation

jaymode
Copy link
Member

@jaymode jaymode commented Jun 16, 2021

System indices should be treated as a special set of indices and not be
accessible by all users. The existing security codebase has the notion
of restricted indices, which are currently a subset of system indices.

This change unifies the two concepts by making system indices the set
of restricted indices. This means that going forward, consumers of
system indices will need access to restricted indices.

Closes #69298

jaymode added 13 commits June 16, 2021 13:48
System indices should be treated as a special set of indices and not be
accessible by all users. The existing security codebase has the notion
of restricted indices, which are currently a subset of system indices.

This change unifies the two concepts by making system indices the set
of restricted indices. This means that going forward, consumers of
system indices will need access to restricted indices.

Closes elastic#69298
This reverts commit b12116b.
@jaymode
Copy link
Member Author

jaymode commented Jun 28, 2021

@elasticmachine run elasticsearch-ci/part-1

@jaymode jaymode marked this pull request as ready for review June 28, 2021 17:50
@jaymode jaymode requested a review from williamrandolph June 28, 2021 17:50
@jaymode jaymode added :Core/Infra/Core Core issues without another label :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC >breaking >enhancement v8.0.0 labels Jun 28, 2021
@elasticmachine elasticmachine added Team:Core/Infra Meta label for core/infra team Team:Security Meta label for security team labels Jun 28, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticmachine
Copy link
Collaborator

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

Copy link
Contributor

@williamrandolph williamrandolph left a comment

Choose a reason for hiding this comment

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

This makes a lot of sense to me.

Much of the code has the goal of replacing a hard-coded list of restricted indices with one that's constructed at node startup. IndexNameExpressionResolver supplies the Security plugin with an automaton that matches all system names, and this automaton is passed to the CompositeRolesStore. The CompositeRolesStore, in turn, constructs every IndicesPermission.Group with a reference to this automaton.

When the application is running, the check for restricted indices happens in the IndicesPermission#checkResourcePrivileges method. (I'm glad that there seems to be one place that handles all of the privilege checking: less potential for bugs.)

Test coverage is good, although I don't see that we have extended test coverage beyond the previous group of restricted indices (security- and async-search-related). I'd like to look at whether we can test that other system indices are treated as restricted.

Since I'm taking this work over from Jay, I will work with Gordon to get this PR merged.

@@ -3,6 +3,7 @@ admin:
- all
indices:
- names: '*'
allow_restricted_indices: true
Copy link
Contributor

Choose a reason for hiding this comment

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

We should give the clients team a heads up about this before we merge; otherwise we might mysteriously break their tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

++

@rdnm
Copy link

rdnm commented Jul 12, 2021

@tvernum and @albertzaharovits - @williamrandolph is going to address some comments and get @gwbrown to review them. However, a broader security review would be appreciated.

@williamrandolph
Copy link
Contributor

@albertzaharovits

should we automatically be creating roles for these features using system indices? Granted we already have hard-coded roles for some.

You know, the update here was part of the work that Jay did originally, and I'm not sure what breaks if we take it out. I'm going to back out some changes to the reserved roles to see where tests break and get you a better answer to this question.

should we emit warnings for user roles in 7.x that cover system indices, and would hence need to be updated to work on 8?

That's a good idea, and I'll make an issue for it as a follow-up.

@williamrandolph
Copy link
Contributor

williamrandolph commented Aug 18, 2021

I spoke to Jay the other day and he didn't have a reason for allowing restricted indices on all of those feature and application roles. We have plenty of test coverage and it all still passes, so I'm going to assume that the "allow restricted indices" change was made by mistake.

I still need to make the issue for a deprecation warning on user roles that try to set access on system indices, but after that I think we should be ready to merge.

  • make issue for deprecating user roles that set privileges on system indices

@williamrandolph williamrandolph merged commit 22e9d37 into elastic:master Aug 20, 2021
williamrandolph added a commit to williamrandolph/elasticsearch that referenced this pull request Aug 25, 2021
A missing piece in elastic#74212 was system index patterns in the tests for the
ReservedRolesStore. Without these patterns, the tests did not accurately
check whether a role was incorrectly accessing a system index that was
not previously a restricted index.

This commit adds all of the current system index patterns to the test
class and adds restricted index access to the system roles that need it
for tests to pass.
williamrandolph added a commit that referenced this pull request Aug 26, 2021
…76845)

* Add system index patterns to TestRestrictedIndices

A missing piece in #74212 was system index patterns in the tests for the
ReservedRolesStore. Without these patterns, the tests did not accurately
check whether a role was incorrectly accessing a system index that was
not previously a restricted index.

This commit adds all of the current system index patterns to the test
class and adds restricted index access to the system roles that need it
for tests to pass.

* Preserve existing Kibana data telemetry privileges
* Test that data telemetry can't access security and async indices
ywangd added a commit to ywangd/elasticsearch that referenced this pull request Sep 10, 2021
Since elastic#74212, all system indices are now treated as restricted indices,
which includes the fleet system indices. As a result, the fleet-server
server account needs privileges to access restricted indices under the
fleet-* namespace.

Relates: elastic#74212
ywangd added a commit that referenced this pull request Sep 10, 2021
Since #74212, all system indices are now treated as restricted indices,
which includes the fleet system indices. As a result, the fleet-server
server account needs privileges to access restricted indices under the
fleet-* namespace.

Relates: #74212
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Core/Infra/Core Core issues without another label >enhancement :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Core/Infra Meta label for core/infra team Team:Security Meta label for security team v8.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate system indices with restricted indices names in security
8 participants