-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix ESO migration decryption for converted saved object types #106897
Fix ESO migration decryption for converted saved object types #106897
Conversation
A bug in the algorithm neglected to differentiate when a converted object may have had its ID changed (this happens when an object exists in a non-default space and then it is converted). This commit fixes the bug and adds several more unit tests and integration tests to exercise different permutations of migrations.
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.
Author's notes for reviewers
x-pack/plugins/encrypted_saved_objects/server/create_migration.ts
Outdated
Show resolved
Hide resolved
ESO migrations should never encrypt non-single-namespace saved object types with a namespace descriptor. This commit updates the migration context to expose an additional field that will help the ESO service to better decide whether to use a namespace in the encryption descriptor.
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.
Besides my comments, there's nothing that stands out to me, but as usual SSO is a complicated beast, so I don't feel 100% comfortable giving this a green light. But fingeres crossed I haven't missed anything 😅
x-pack/plugins/encrypted_saved_objects/server/create_migration.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/encrypted_saved_objects/server/create_migration.ts
Outdated
Show resolved
Hide resolved
* Address PR review feedback * Rename "convertToMultiNamespaceType" boolean to "isTypeBeingConverted" * Update createMigration() function to use consistent encryption descriptors too * Add post-conversion migration unit test cases for createMigration() * Update decryptAttributesSync unit test cases for ESO service
Thanks a ton for the review! Actually when I went to change "Semver" to "semver", I realized I was missing a pretty important unit test case for when the call to "semver.lte()" returns false (post-conversion, e.g., test with migrationVersion >= 8.0.1). I added that and some other missing stuff in 1f70513. Since this is so complex, perhaps @legrego or @azasypkin can also take a second pass? |
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.
Changes to the SO migrations look fine to me, I'm glad we discovered the issue early 😄 .
I just have one question around retaining support for single-namespace
SO types but that' more out of curiosity.
LGTM once CI goes green
These broke with the most recent merge upstream.
ACK: taking a look... |
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
x-pack/plugins/encrypted_saved_objects/server/crypto/encrypted_saved_objects_service.ts
Outdated
Show resolved
Hide resolved
…_saved_objects_service.ts Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
💚 Build SucceededMetrics [docs]Unknown metric groupsAPI count
API count missing comments
API count with any type
Non-exported public API item count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…106897) (#107189) * Fix ESO migration decryption for converted saved object types (#106897) * Get rid of integration test changes The integration test changes can only be applied in 8.0 or later. We can safely remove that from the 7.x branch. Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>
Resolves #106567.
A bug in the algorithm neglected to differentiate when a converted object may have had its ID changed (this happens when an object exists in a non-default space and then it is converted).
This PR fixes the bug and adds several more unit tests and integration tests to exercise different permutations of migrations.
Note that this is a bug fix but I am not labeling it as such, and I am not backporting it to earlier versions of Kibana, because no consumers are using the aforementioned conversion functionality yet.