-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Make reserved built-in roles queryable #117581
Merged
elasticsearchmachine
merged 68 commits into
elastic:main
from
slobodanadamovic:sa-queryable-built-in-roles
Dec 16, 2024
Merged
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
73f0307
Make reserved built-in roles queryable
slobodanadamovic 784a922
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic 3c78126
export queryable classes
slobodanadamovic 5a1c233
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic 252e140
suppress 'this-escape' warning
slobodanadamovic 9bba1aa
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic c3b41ab
introduce a factory interface in order to be able to inject different…
slobodanadamovic b83410c
export org.elasticsearch.xpack.security.authz.store
slobodanadamovic cb70eff
allow returning all file role definitions
slobodanadamovic 31b4fb2
mark query roles API as public in serverless
slobodanadamovic 4d6bd57
imports are important
slobodanadamovic 8ca36ad
remove assertion as it's not true in all use cases
slobodanadamovic 7b278e6
remove unused import
slobodanadamovic 8c71c73
test reserved roles are all indexed and cannot be modified via API
slobodanadamovic 58f132e
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic c679261
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic 9cae158
document feature flag
slobodanadamovic 57cac14
code cleanup
slobodanadamovic 1330265
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic e821710
test that hash calculation produces consistent hash digest
slobodanadamovic d27c91b
update log message
slobodanadamovic 9e7076d
simple unit test for reserved roles provider
slobodanadamovic 0e85b77
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic 1b56b95
make collections immutable
slobodanadamovic f35ba07
fix failing test
slobodanadamovic 71ed79b
remove unused import
slobodanadamovic f4e0292
Update docs/changelog/117581.yaml
slobodanadamovic d94da64
mark query API as internal for now
slobodanadamovic ada74e1
mark correct API as internal
slobodanadamovic 2defd9b
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic 32d4494
test get reserved roles
slobodanadamovic ba7541c
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic 56d49b3
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic 21646f5
remove QueryableBuiltInRolesStore and depend on NativeRolesStore
slobodanadamovic a229e82
move concrete index name resolution after index gets created
slobodanadamovic 8e551b7
revert changes to QueryRoleIT
slobodanadamovic c633037
test that bulk delete of built-in roles fails
slobodanadamovic d4f99f2
log 'expected' errors at info level
slobodanadamovic 8cc05ab
use delegateFailureAndWrap
slobodanadamovic 085755d
sanity check rolesToDelete and rolesToUpsert
slobodanadamovic c3ee0b5
return empty query result if native roles are disabled
slobodanadamovic a6bc077
naming nit validateRoles -> allowReservedRoleNames
slobodanadamovic e12c3e8
trace -> debug
slobodanadamovic 70181d6
change role hashing implementation to hash ordered and flattened JSON…
slobodanadamovic aa64c4d
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic 7dce761
avoid magic numbers in assertion
slobodanadamovic d400669
introduce a test plugin in order to test reserved roles change
slobodanadamovic 78ea695
ignore javadoc in test plugin
slobodanadamovic cde5382
test closing and deleting .security index
slobodanadamovic 1b54b5c
imports
slobodanadamovic f0d4810
wait a bit longer after cluster restart
slobodanadamovic 1b88a5d
move static methods to utility class
slobodanadamovic fec25ae
better exception handling and code cleanup
slobodanadamovic a771b52
Merge branch 'main' of github.com:elastic/elasticsearch into sa-query…
slobodanadamovic 1fa03d7
fix logger usage
slobodanadamovic 36f1085
unit test rolesToUpsert and rolesToDelete
slobodanadamovic 5aacc30
wait for the index to be deleted
slobodanadamovic ac5c837
handle cases when .security index gets deleted in the mean time
slobodanadamovic 9d5982b
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic 123c890
switch to LinkedHashSet to keep ordering same as before (when List wa…
slobodanadamovic ee484b3
validateRoleDescriptors
slobodanadamovic 5cd4e81
deduplicate log messages
slobodanadamovic 7d09bbf
validateRoleNames
slobodanadamovic ca6485a
test with randomized metadata order
slobodanadamovic d9f69f7
test no updates with different digests instances
slobodanadamovic d691466
test no updates needed with randomized role and its copy
slobodanadamovic 8343448
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic a253252
Merge branch 'main' into sa-queryable-built-in-roles
slobodanadamovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 117581 | ||
summary: Make reserved built-in roles queryable | ||
area: Authorization | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
354 changes: 354 additions & 0 deletions
354
...asic/src/javaRestTest/java/org/elasticsearch/xpack/security/QueryableReservedRolesIT.java
Large diffs are not rendered by default.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
x-pack/plugin/security/qa/security-basic/src/main/java/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module org.elasticsearch.internal.security { | ||
requires org.elasticsearch.base; | ||
requires org.elasticsearch.server; | ||
requires org.elasticsearch.xcore; | ||
requires org.elasticsearch.security; | ||
} |
22 changes: 22 additions & 0 deletions
22
.../src/main/java/org/elasticsearch/xpack/security/role/QueryableBuiltInRolesTestPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.security.role; | ||
|
||
import org.elasticsearch.common.settings.Setting; | ||
import org.elasticsearch.plugins.Plugin; | ||
import org.elasticsearch.xpack.core.security.authz.store.ReservedRolesStore; | ||
|
||
import java.util.List; | ||
|
||
public class QueryableBuiltInRolesTestPlugin extends Plugin { | ||
|
||
@Override | ||
public List<Setting<?>> getSettings() { | ||
return List.of(ReservedRolesStore.INCLUDED_RESERVED_ROLES_SETTING); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a set here, since list caused duplicate results to be returned. I would propose we keep this workaround, until we enable this feature by default. Later we can remove the logic of combining static and native roles here, and always return roles from the .security index.