-
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 issue with duplicate references in error object when copying saved objects to space #200053
Fix issue with duplicate references in error object when copying saved objects to space #200053
Conversation
…d objects to space
Pinging @elastic/kibana-security (Team:Security) |
@elasticmachine merge upstream |
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.
Thanks for fixing this one, Sid! Works as expected. Just left a nit from the original implementation. And I like your idea of adding a new integration test.
// skip objects with retries that have specified `ignoreMissingReferences` | ||
return; | ||
continue; | ||
} | ||
|
||
const missingReferences = []; |
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.
Retro nit: I know this was here before, but we should give this a type rather than default to any[]
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.
Updated in: 5544b88
@SiddharthMantri Should we backport to prev major to get this into 8.17? |
Oh yeah, i keep forgetting main goes to 9.0. Yes, I've added the label for 8.17, thank 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.
Overall LGTM, would be nice to add a case to the existing unit test for this dedupe behaviour
packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.test.ts
+1 for adding a unit test. If an integration test is overkill/too complicated to add, just having a unit test is probably enough. |
@elasticmachine merge upstream |
Starting backport for target branches: 8.15, 8.16, 8.x https://github.com/elastic/kibana/actions/runs/11895980917 |
💚 Build Succeeded
Metrics [docs]
History
|
…d objects to space (elastic#200053) Closes elastic#158027 ## Summary Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint ### Notes - Update forEach over SOs to a regular for loop since we had a couple of early exit scenarios - Checks against the set for references already added to the missing list and adds only if not present ------ **Old response: Note the duplicate references** <img width="400" alt="Screenshot 2024-11-14 at 01 52 54" src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4"> **New response** <img width="800" alt="Screenshot 2024-11-14 at 01 50 41" src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9"> ### Release note Dedupe results from copy saved objects to spaces API when object contains references to other objects. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 262b48f)
…d objects to space (elastic#200053) Closes elastic#158027 ## Summary Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint ### Notes - Update forEach over SOs to a regular for loop since we had a couple of early exit scenarios - Checks against the set for references already added to the missing list and adds only if not present ------ **Old response: Note the duplicate references** <img width="400" alt="Screenshot 2024-11-14 at 01 52 54" src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4"> **New response** <img width="800" alt="Screenshot 2024-11-14 at 01 50 41" src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9"> ### Release note Dedupe results from copy saved objects to spaces API when object contains references to other objects. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 262b48f)
…d objects to space (elastic#200053) Closes elastic#158027 ## Summary Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint ### Notes - Update forEach over SOs to a regular for loop since we had a couple of early exit scenarios - Checks against the set for references already added to the missing list and adds only if not present ------ **Old response: Note the duplicate references** <img width="400" alt="Screenshot 2024-11-14 at 01 52 54" src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4"> **New response** <img width="800" alt="Screenshot 2024-11-14 at 01 50 41" src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9"> ### Release note Dedupe results from copy saved objects to spaces API when object contains references to other objects. --------- Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 262b48f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ng saved objects to space (#200053) (#200599) # Backport This will backport the following commits from `main` to `8.15`: - [Fix issue with duplicate references in error object when copying saved objects to space (#200053)](#200053) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix issue with duplicate references in error object when copying saved objects to space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Sid <[email protected]>
…ng saved objects to space (#200053) (#200600) # Backport This will backport the following commits from `main` to `8.16`: - [Fix issue with duplicate references in error object when copying saved objects to space (#200053)](#200053) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix issue with duplicate references in error object when copying saved objects to space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Sid <[email protected]>
…g saved objects to space (#200053) (#200601) # Backport This will backport the following commits from `main` to `8.x`: - [Fix issue with duplicate references in error object when copying saved objects to space (#200053)](#200053) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix issue with duplicate references in error object when copying saved objects to space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix issue with duplicate references in error object when copying saved objects to space (#200053)\n\nCloses https://github.com/elastic/kibana/issues/158027\r\n\r\n## Summary\r\n\r\nSimply dedupes references to objects if they are part of the\r\nmissing_references in the copy saved objects to SO endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for loop since we had a couple of\r\nearly exit scenarios\r\n- Checks against the set for references already added to the missing\r\nlist and adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot 2024-11-14 at 01 52 54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01 50 41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n### Release note\r\nDedupe results from copy saved objects to spaces API when object\r\ncontains references to other objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Sid <[email protected]>
…d objects to space (elastic#200053) Closes elastic#158027 ## Summary Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint ### Notes - Update forEach over SOs to a regular for loop since we had a couple of early exit scenarios - Checks against the set for references already added to the missing list and adds only if not present ------ **Old response: Note the duplicate references** <img width="400" alt="Screenshot 2024-11-14 at 01 52 54" src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4"> **New response** <img width="800" alt="Screenshot 2024-11-14 at 01 50 41" src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9"> ### Release note Dedupe results from copy saved objects to spaces API when object contains references to other objects. --------- Co-authored-by: Elastic Machine <[email protected]>
…d objects to space (elastic#200053) Closes elastic#158027 ## Summary Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint ### Notes - Update forEach over SOs to a regular for loop since we had a couple of early exit scenarios - Checks against the set for references already added to the missing list and adds only if not present ------ **Old response: Note the duplicate references** <img width="400" alt="Screenshot 2024-11-14 at 01 52 54" src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4"> **New response** <img width="800" alt="Screenshot 2024-11-14 at 01 50 41" src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9"> ### Release note Dedupe results from copy saved objects to spaces API when object contains references to other objects. --------- Co-authored-by: Elastic Machine <[email protected]>
Closes #158027
Summary
Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint
Notes
Old response: Note the duplicate references
New response
Release note
Dedupe results from copy saved objects to spaces API when object contains references to other objects.