-
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
[UII] Drop ssl field from output if it's in an invalid format #211848
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@@ -128,7 +128,7 @@ function outputSavedObjectToOutput(so: SavedObject<OutputSOAttributes>): Output | |||
return { | |||
id: outputId ?? so.id, | |||
...atributes, | |||
...(ssl ? { ssl: JSON.parse(ssl as string) } : {}), | |||
...(typeof ssl === 'string' ? { ssl: JSON.parse(ssl as string) } : {}), |
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.
ssl can still be an invalid JSON, even though it's a string. Shouldn't we wrap JSON.parse
in try catch?
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.
good point, updated code and added unit tests
💚 Build Succeeded
Metrics [docs]
cc @jen-huang |
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
Starting backport for target branches: 8.16, 8.17, 8.18, 8.x |
…c#211848) ## Summary Reported in elastic/sdh-beats#5676. When retrieving outputs information, drop the `ssl` field if it's in an invalid format (causing `JSON.parse` to fail). This can happen for ES output with `ssl` field set via API, and then subsequently editing it from the UI (ES output `ssl` fields are currently unsupported, soon to be supported by elastic#207326. --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 0c932fd)
…c#211848) ## Summary Reported in elastic/sdh-beats#5676. When retrieving outputs information, drop the `ssl` field if it's in an invalid format (causing `JSON.parse` to fail). This can happen for ES output with `ssl` field set via API, and then subsequently editing it from the UI (ES output `ssl` fields are currently unsupported, soon to be supported by elastic#207326. --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 0c932fd)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
…211848) (#212016) # Backport This will backport the following commits from `main` to `8.x`: - [[UII] Drop ssl field from output if it's in an invalid format (#211848)](#211848) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jen Huang","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-21T08:52:17Z","message":"[UII] Drop ssl field from output if it's in an invalid format (#211848)\n\n## Summary\n\nReported in elastic/sdh-beats#5676. When\nretrieving outputs information, drop the `ssl` field if it's in an\ninvalid format (causing `JSON.parse` to fail).\n\nThis can happen for ES output with `ssl` field set via API, and then\nsubsequently editing it from the UI (ES output `ssl` fields are\ncurrently unsupported, soon to be supported by\nhttps://github.com//issues/207326.\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"0c932fd4aba794767bf2298911e0f2e2ec2bffb3","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-major","v9.1.0"],"title":"[UII] Drop ssl field from output if it's in an invalid format","number":211848,"url":"https://github.com/elastic/kibana/pull/211848","mergeCommit":{"message":"[UII] Drop ssl field from output if it's in an invalid format (#211848)\n\n## Summary\n\nReported in elastic/sdh-beats#5676. When\nretrieving outputs information, drop the `ssl` field if it's in an\ninvalid format (causing `JSON.parse` to fail).\n\nThis can happen for ES output with `ssl` field set via API, and then\nsubsequently editing it from the UI (ES output `ssl` fields are\ncurrently unsupported, soon to be supported by\nhttps://github.com//issues/207326.\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"0c932fd4aba794767bf2298911e0f2e2ec2bffb3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211848","number":211848,"mergeCommit":{"message":"[UII] Drop ssl field from output if it's in an invalid format (#211848)\n\n## Summary\n\nReported in elastic/sdh-beats#5676. When\nretrieving outputs information, drop the `ssl` field if it's in an\ninvalid format (causing `JSON.parse` to fail).\n\nThis can happen for ES output with `ssl` field set via API, and then\nsubsequently editing it from the UI (ES output `ssl` fields are\ncurrently unsupported, soon to be supported by\nhttps://github.com//issues/207326.\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"0c932fd4aba794767bf2298911e0f2e2ec2bffb3"}}]}] BACKPORT--> Co-authored-by: Jen Huang <[email protected]>
…211848) (#212015) # Backport This will backport the following commits from `main` to `8.18`: - [[UII] Drop ssl field from output if it's in an invalid format (#211848)](#211848) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jen Huang","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-21T08:52:17Z","message":"[UII] Drop ssl field from output if it's in an invalid format (#211848)\n\n## Summary\n\nReported in elastic/sdh-beats#5676. When\nretrieving outputs information, drop the `ssl` field if it's in an\ninvalid format (causing `JSON.parse` to fail).\n\nThis can happen for ES output with `ssl` field set via API, and then\nsubsequently editing it from the UI (ES output `ssl` fields are\ncurrently unsupported, soon to be supported by\nhttps://github.com//issues/207326.\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"0c932fd4aba794767bf2298911e0f2e2ec2bffb3","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-major","v9.1.0"],"title":"[UII] Drop ssl field from output if it's in an invalid format","number":211848,"url":"https://github.com/elastic/kibana/pull/211848","mergeCommit":{"message":"[UII] Drop ssl field from output if it's in an invalid format (#211848)\n\n## Summary\n\nReported in elastic/sdh-beats#5676. When\nretrieving outputs information, drop the `ssl` field if it's in an\ninvalid format (causing `JSON.parse` to fail).\n\nThis can happen for ES output with `ssl` field set via API, and then\nsubsequently editing it from the UI (ES output `ssl` fields are\ncurrently unsupported, soon to be supported by\nhttps://github.com//issues/207326.\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"0c932fd4aba794767bf2298911e0f2e2ec2bffb3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211848","number":211848,"mergeCommit":{"message":"[UII] Drop ssl field from output if it's in an invalid format (#211848)\n\n## Summary\n\nReported in elastic/sdh-beats#5676. When\nretrieving outputs information, drop the `ssl` field if it's in an\ninvalid format (causing `JSON.parse` to fail).\n\nThis can happen for ES output with `ssl` field set via API, and then\nsubsequently editing it from the UI (ES output `ssl` fields are\ncurrently unsupported, soon to be supported by\nhttps://github.com//issues/207326.\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"0c932fd4aba794767bf2298911e0f2e2ec2bffb3"}}]}] BACKPORT--> Co-authored-by: Jen Huang <[email protected]>
Summary
Reported in https://github.com/elastic/sdh-beats/issues/5676. When retrieving outputs information, drop the
ssl
field if it's in an invalid format (causingJSON.parse
to fail).This can happen for ES output with
ssl
field set via API, and then subsequently editing it from the UI (ES outputssl
fields are currently unsupported, soon to be supported by #207326.