Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.16] [Security Solution] [Security assistant] Fixes errors when cre…
…ating conversations with special characters in the title (elastic#197319) (elastic#197495) # Backport This will backport the following commits from `main` to `8.16`: - [[Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title (elastic#197319)](elastic#197319) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Andrew Macri","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-23T16:13:19Z","message":"[Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title (elastic#197319)\n\n### [Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title\r\n\r\nThis PR fixes an [issue](elastic/security-team#10284) in the security assistant where attempting to create conversations with special characters in the title, i.e. a `:`, resulted in an `Error creating conversation with title...` toaster.\r\n\r\n### Desk testing\r\n\r\nTo reproduce, simulate generation of a title with special characters:\r\n\r\n1) Edit `x-pack/plugins/security_solution/public/attack_discovery/attack_discovery_panel/view_in_ai_assistant/use_view_in_ai_assistant.ts`\r\n\r\nchange the following line:\r\n\r\nfrom\r\n\r\n```ts\r\nconst lastFive = attackDiscovery.id ? ` - ${attackDiscovery.id.slice(-5)}` : '';\r\n```\r\n\r\nto\r\n\r\n```ts\r\nconst lastFive = attackDiscovery.id ? ` - test: \"${attackDiscovery.id.slice(-5)}\"` : '';\r\n```\r\n\r\n2) Navigate to Security > Attack discovery\r\n\r\n3) Click the `View in AI Assistant` link for any attack discovery\r\n\r\n**Expected result**\r\n\r\n- The assistant flyout opens without errors\r\n\r\n**Actual result**\r\n\r\n- The assistant flyout opens with a toaster error like the following example:\r\n\r\n```\r\nError creating conversation with title Sophisticated Multi-Stage Attack Detected - test: \"7a882\"\r\n```","sha":"a2a43e7a3a964cdcc9ca38cf90ea429e2a98edd8","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","v9.0.0","Team: SecuritySolution","Team:Security Generative AI","v8.16.0","backport:version"],"title":"[Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title","number":197319,"url":"https://github.com/elastic/kibana/pull/197319","mergeCommit":{"message":"[Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title (elastic#197319)\n\n### [Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title\r\n\r\nThis PR fixes an [issue](elastic/security-team#10284) in the security assistant where attempting to create conversations with special characters in the title, i.e. a `:`, resulted in an `Error creating conversation with title...` toaster.\r\n\r\n### Desk testing\r\n\r\nTo reproduce, simulate generation of a title with special characters:\r\n\r\n1) Edit `x-pack/plugins/security_solution/public/attack_discovery/attack_discovery_panel/view_in_ai_assistant/use_view_in_ai_assistant.ts`\r\n\r\nchange the following line:\r\n\r\nfrom\r\n\r\n```ts\r\nconst lastFive = attackDiscovery.id ? ` - ${attackDiscovery.id.slice(-5)}` : '';\r\n```\r\n\r\nto\r\n\r\n```ts\r\nconst lastFive = attackDiscovery.id ? ` - test: \"${attackDiscovery.id.slice(-5)}\"` : '';\r\n```\r\n\r\n2) Navigate to Security > Attack discovery\r\n\r\n3) Click the `View in AI Assistant` link for any attack discovery\r\n\r\n**Expected result**\r\n\r\n- The assistant flyout opens without errors\r\n\r\n**Actual result**\r\n\r\n- The assistant flyout opens with a toaster error like the following example:\r\n\r\n```\r\nError creating conversation with title Sophisticated Multi-Stage Attack Detected - test: \"7a882\"\r\n```","sha":"a2a43e7a3a964cdcc9ca38cf90ea429e2a98edd8"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197319","number":197319,"mergeCommit":{"message":"[Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title (elastic#197319)\n\n### [Security Solution] [Security assistant] Fixes errors when creating conversations with special characters in the title\r\n\r\nThis PR fixes an [issue](elastic/security-team#10284) in the security assistant where attempting to create conversations with special characters in the title, i.e. a `:`, resulted in an `Error creating conversation with title...` toaster.\r\n\r\n### Desk testing\r\n\r\nTo reproduce, simulate generation of a title with special characters:\r\n\r\n1) Edit `x-pack/plugins/security_solution/public/attack_discovery/attack_discovery_panel/view_in_ai_assistant/use_view_in_ai_assistant.ts`\r\n\r\nchange the following line:\r\n\r\nfrom\r\n\r\n```ts\r\nconst lastFive = attackDiscovery.id ? ` - ${attackDiscovery.id.slice(-5)}` : '';\r\n```\r\n\r\nto\r\n\r\n```ts\r\nconst lastFive = attackDiscovery.id ? ` - test: \"${attackDiscovery.id.slice(-5)}\"` : '';\r\n```\r\n\r\n2) Navigate to Security > Attack discovery\r\n\r\n3) Click the `View in AI Assistant` link for any attack discovery\r\n\r\n**Expected result**\r\n\r\n- The assistant flyout opens without errors\r\n\r\n**Actual result**\r\n\r\n- The assistant flyout opens with a toaster error like the following example:\r\n\r\n```\r\nError creating conversation with title Sophisticated Multi-Stage Attack Detected - test: \"7a882\"\r\n```","sha":"a2a43e7a3a964cdcc9ca38cf90ea429e2a98edd8"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Andrew Macri <[email protected]>
- Loading branch information