-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add ECK Role Mapping Cleanup #115823
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
Add ECK Role Mapping Cleanup #115823
Conversation
|
Pinging @elastic/es-security (Team:Security) |
|
Hi @jfreden, I've created a changelog YAML for you. |
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.
LGTM 🚀 Great work on this, and thanks for iterating!
| // i.e. it is NOT created in a previous ES version that potentially didn't index the role metadata | ||
| // * or, the .security index has been migrated (using an internal update-by-query) such that the metadata is queryable | ||
| return frozenSecurityIndex.isCreatedOnLatestVersion() | ||
| return frozenSecurityIndex.isCreatedOnLatestMigrationVersion() |
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.
Lets rename this back to isCreatedOnLatestVersion
| "metadata.indices" | ||
| ); | ||
| assertNotNull(indices); | ||
| // JsonMapView doesn't support . prefixed indices (splits on .) |
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.
Should we assert that indices contain a key for .security-7?
|
Hi @jfreden, I've created a changelog YAML for you. |
💔 Backport failedThe backport operation could not be completed due to the following error: You can use sqren/backport to manually backport by running |
* Add security migration for cleaning up ECK role mappings (cherry picked from commit a7031d8) # Conflicts: # server/src/main/java/org/elasticsearch/index/IndexVersions.java # x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityMigrations.java # x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/AbstractUpgradeTestCase.java
💔 Some backports could not be created
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
* Add security migration for cleaning up ECK role mappings
This PR adds a cleanup security migration for role mapping duplicates that exist both in cluster state and the
.securityindex. The cleanup task is implemented as a security migration.The task compares the names of the role mappings in the operator-defined settings.json and the names of the role mappings in the
.securityindex and removes the ones in the.securityindex.See related PR for full review: #114830
Issue
This cleanup is done because there was a bug (fixed #114337) that caused ECK customers to have the same role mappings with the same names present both in cluster state and the .security index. The effective role mapping is the combination of the .security index mapping and the cluster state one. After the bug #114337, if the mapping in cluster state is modified (through setting.json), the .security index will still contain the old mapping and this could lead to unintended behaviour.