Skip to content
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

[8.x] Fixed an error with missing uids in the cases detail page (#207228) #207873

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

…7228)

Fixes elastic#206801

## Summary

When opening the case detail page we retrieve user profile info for the
different case user actions.

If the uid stored in ES is an empty string for any of these user
actions, we get an error that looks like this:

![Screenshot 2025-01-20 at 12 34
54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)

### Steps to reproduce/test (thanks @jcger )

1. Create a user with the `system_indices_superuser` role
2. Create a case and assign a user to it
3. Get the ID of the assignment user action from the case above
```
GET .kibana_alerting_cases/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "type": "cases-user-actions"
          }
        },
        {
          "term": {
            "cases-user-actions.type": "assignees"
          }
        },
        {
          "nested": {
            "path": "references",
            "query": {
              "bool": {
                "filter": [
                  {
                    "term": {
                      "references.type": "cases"
                    }
                  },
                  {
                    "term": {
                      "references.id": "<case_id>"
                    }
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}
```
4. Manually set the `uid` of the assignee to `""`
```
POST .kibana_alerting_cases/_update/<cases-user-actions-id>
{
  "script": {
    "source": """
        ctx._source["cases-user-actions"].payload.assignees[0].uid = "";
    """
  }
}
```

After this PR the popup should **not** appear anymore.

(cherry picked from commit d8e5cbf)
@kibanamachine kibanamachine merged commit 06af0cf into elastic:8.x Jan 22, 2025
11 checks passed
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #76 / Alerting getAlertSummary multi-alert maintenance window handles multi-alert status during maintenance window

Metrics [docs]

✅ unchanged

cc @adcoelho

adcoelho added a commit that referenced this pull request Jan 23, 2025
…7228) (#208055)

# Backport

This will backport the following commits from `main` to `8.17`:
- [Fixed an error with missing uids in the cases detail page
(#207228)](#207228)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Antonio","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-22T16:15:43Z","message":"Fixed
an error with missing uids in the cases detail page (#207228)\n\nFixes
#206801\r\n\r\n## Summary\r\n\r\nWhen opening the case detail page we
retrieve user profile info for the\r\ndifferent case user
actions.\r\n\r\nIf the uid stored in ES is an empty string for any of
these user\r\nactions, we get an error that looks like
this:\r\n\r\n![Screenshot 2025-01-20 at 12
34\r\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\r\n\r\n\r\n###
Steps to reproduce/test (thanks @jcger )\r\n\r\n1. Create a user with
the `system_indices_superuser` role\r\n2. Create a case and assign a
user to it\r\n3. Get the ID of the assignment user action from the case
above\r\n```\r\nGET .kibana_alerting_cases/_search\r\n{\r\n \"query\":
{\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"type\":
\"cases-user-actions\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"cases-user-actions.type\": \"assignees\"\r\n }\r\n },\r\n {\r\n
\"nested\": {\r\n \"path\": \"references\",\r\n \"query\": {\r\n
\"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n
\"references.type\": \"cases\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"references.id\": \"<case_id>\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n
}\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n4. Manually set the `uid` of the
assignee to `\"\"`\r\n```\r\nPOST
.kibana_alerting_cases/_update/<cases-user-actions-id>\r\n{\r\n
\"script\": {\r\n \"source\": \"\"\"\r\n
ctx._source[\"cases-user-actions\"].payload.assignees[0].uid = \"\";\r\n
\"\"\"\r\n }\r\n}\r\n```\r\n\r\nAfter this PR the popup should **not**
appear
anymore.","sha":"d8e5cbf67f2bae859a18f956c22205b78d3da5aa","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","Feature:Cases","backport:prev-major","v8.18.0","v8.16.4","v8.17.2"],"title":"Fixed
an error with missing uids in the cases detail
page","number":207228,"url":"https://github.com/elastic/kibana/pull/207228","mergeCommit":{"message":"Fixed
an error with missing uids in the cases detail page (#207228)\n\nFixes
#206801\r\n\r\n## Summary\r\n\r\nWhen opening the case detail page we
retrieve user profile info for the\r\ndifferent case user
actions.\r\n\r\nIf the uid stored in ES is an empty string for any of
these user\r\nactions, we get an error that looks like
this:\r\n\r\n![Screenshot 2025-01-20 at 12
34\r\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\r\n\r\n\r\n###
Steps to reproduce/test (thanks @jcger )\r\n\r\n1. Create a user with
the `system_indices_superuser` role\r\n2. Create a case and assign a
user to it\r\n3. Get the ID of the assignment user action from the case
above\r\n```\r\nGET .kibana_alerting_cases/_search\r\n{\r\n \"query\":
{\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"type\":
\"cases-user-actions\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"cases-user-actions.type\": \"assignees\"\r\n }\r\n },\r\n {\r\n
\"nested\": {\r\n \"path\": \"references\",\r\n \"query\": {\r\n
\"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n
\"references.type\": \"cases\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"references.id\": \"<case_id>\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n
}\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n4. Manually set the `uid` of the
assignee to `\"\"`\r\n```\r\nPOST
.kibana_alerting_cases/_update/<cases-user-actions-id>\r\n{\r\n
\"script\": {\r\n \"source\": \"\"\"\r\n
ctx._source[\"cases-user-actions\"].payload.assignees[0].uid = \"\";\r\n
\"\"\"\r\n }\r\n}\r\n```\r\n\r\nAfter this PR the popup should **not**
appear
anymore.","sha":"d8e5cbf67f2bae859a18f956c22205b78d3da5aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207228","number":207228,"mergeCommit":{"message":"Fixed
an error with missing uids in the cases detail page (#207228)\n\nFixes
#206801\r\n\r\n## Summary\r\n\r\nWhen opening the case detail page we
retrieve user profile info for the\r\ndifferent case user
actions.\r\n\r\nIf the uid stored in ES is an empty string for any of
these user\r\nactions, we get an error that looks like
this:\r\n\r\n![Screenshot 2025-01-20 at 12
34\r\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\r\n\r\n\r\n###
Steps to reproduce/test (thanks @jcger )\r\n\r\n1. Create a user with
the `system_indices_superuser` role\r\n2. Create a case and assign a
user to it\r\n3. Get the ID of the assignment user action from the case
above\r\n```\r\nGET .kibana_alerting_cases/_search\r\n{\r\n \"query\":
{\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"type\":
\"cases-user-actions\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"cases-user-actions.type\": \"assignees\"\r\n }\r\n },\r\n {\r\n
\"nested\": {\r\n \"path\": \"references\",\r\n \"query\": {\r\n
\"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n
\"references.type\": \"cases\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"references.id\": \"<case_id>\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n
}\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n4. Manually set the `uid` of the
assignee to `\"\"`\r\n```\r\nPOST
.kibana_alerting_cases/_update/<cases-user-actions-id>\r\n{\r\n
\"script\": {\r\n \"source\": \"\"\"\r\n
ctx._source[\"cases-user-actions\"].payload.assignees[0].uid = \"\";\r\n
\"\"\"\r\n }\r\n}\r\n```\r\n\r\nAfter this PR the popup should **not**
appear
anymore.","sha":"d8e5cbf67f2bae859a18f956c22205b78d3da5aa"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/207873","number":207873,"state":"MERGED","mergeCommit":{"sha":"06af0cf9a340eee1f5678af8797c442834c173e7","message":"[8.x]
Fixed an error with missing uids in the cases detail page (#207228)
(#207873)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.x`:\n- [Fixed an error with missing uids in the cases
detail
page\n(#207228)](https://github.com/elastic/kibana/pull/207228)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT\n[{\"author\":{\"name\":\"Antonio\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2025-01-22T16:15:43Z\",\"message\":\"Fixed\nan
error with missing uids in the cases detail page
(#207228)\\n\\nFixes\n#206801\\r\\n\\r\\n## Summary\\r\\n\\r\\nWhen
opening the case detail page we\nretrieve user profile info for
the\\r\\ndifferent case user\nactions.\\r\\n\\r\\nIf the uid stored in
ES is an empty string for any of\nthese user\\r\\nactions, we get an
error that looks like\nthis:\\r\\n\\r\\n![Screenshot 2025-01-20 at
12\n34\\r\\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\\r\\n\\r\\n\\r\\n###\nSteps
to reproduce/test (thanks @jcger )\\r\\n\\r\\n1. Create a user with\nthe
`system_indices_superuser` role\\r\\n2. Create a case and assign a\nuser
to it\\r\\n3. Get the ID of the assignment user action from the
case\nabove\\r\\n```\\r\\nGET
.kibana_alerting_cases/_search\\r\\n{\\r\\n \\\"query\\\":\n{\\r\\n
\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n \\\"term\\\":
{\\r\\n \\\"type\\\":\n\\\"cases-user-actions\\\"\\r\\n }\\r\\n },\\r\\n
{\\r\\n \\\"term\\\": {\\r\\n\n\\\"cases-user-actions.type\\\":
\\\"assignees\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n\n\\\"nested\\\":
{\\r\\n \\\"path\\\": \\\"references\\\",\\r\\n \\\"query\\\":
{\\r\\n\n\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n
\\\"term\\\": {\\r\\n\n\\\"references.type\\\": \\\"cases\\\"\\r\\n
}\\r\\n },\\r\\n {\\r\\n \\\"term\\\": {\\r\\n\n\\\"references.id\\\":
\\\"<case_id>\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n
}\\r\\n\n}\\r\\n ]\\r\\n }\\r\\n }\\r\\n}\\r\\n```\\r\\n4. Manually set
the `uid` of the\nassignee to
`\\\"\\\"`\\r\\n```\\r\\nPOST\n.kibana_alerting_cases/_update/<cases-user-actions-id>\\r\\n{\\r\\n\n\\\"script\\\":
{\\r\\n \\\"source\\\":
\\\"\\\"\\\"\\r\\n\nctx._source[\\\"cases-user-actions\\\"].payload.assignees[0].uid
= \\\"\\\";\\r\\n\n\\\"\\\"\\\"\\r\\n }\\r\\n}\\r\\n```\\r\\n\\r\\nAfter
this PR the popup should
**not**\nappear\nanymore.\",\"sha\":\"d8e5cbf67f2bae859a18f956c22205b78d3da5aa\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.18.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"bug\",\"release_note:skip\",\"Team:ResponseOps\",\"v9.0.0\",\"Feature:Cases\",\"backport:prev-minor\"],\"title\":\"Fixed\nan
error with missing uids in the cases
detail\npage\",\"number\":207228,\"url\":\"https://github.com/elastic/kibana/pull/207228\",\"mergeCommit\":{\"message\":\"Fixed\nan
error with missing uids in the cases detail page
(#207228)\\n\\nFixes\n#206801\\r\\n\\r\\n## Summary\\r\\n\\r\\nWhen
opening the case detail page we\nretrieve user profile info for
the\\r\\ndifferent case user\nactions.\\r\\n\\r\\nIf the uid stored in
ES is an empty string for any of\nthese user\\r\\nactions, we get an
error that looks like\nthis:\\r\\n\\r\\n![Screenshot 2025-01-20 at
12\n34\\r\\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\\r\\n\\r\\n\\r\\n###\nSteps
to reproduce/test (thanks @jcger )\\r\\n\\r\\n1. Create a user with\nthe
`system_indices_superuser` role\\r\\n2. Create a case and assign a\nuser
to it\\r\\n3. Get the ID of the assignment user action from the
case\nabove\\r\\n```\\r\\nGET
.kibana_alerting_cases/_search\\r\\n{\\r\\n \\\"query\\\":\n{\\r\\n
\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n \\\"term\\\":
{\\r\\n \\\"type\\\":\n\\\"cases-user-actions\\\"\\r\\n }\\r\\n },\\r\\n
{\\r\\n \\\"term\\\": {\\r\\n\n\\\"cases-user-actions.type\\\":
\\\"assignees\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n\n\\\"nested\\\":
{\\r\\n \\\"path\\\": \\\"references\\\",\\r\\n \\\"query\\\":
{\\r\\n\n\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n
\\\"term\\\": {\\r\\n\n\\\"references.type\\\": \\\"cases\\\"\\r\\n
}\\r\\n },\\r\\n {\\r\\n \\\"term\\\": {\\r\\n\n\\\"references.id\\\":
\\\"<case_id>\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n
}\\r\\n\n}\\r\\n ]\\r\\n }\\r\\n }\\r\\n}\\r\\n```\\r\\n4. Manually set
the `uid` of the\nassignee to
`\\\"\\\"`\\r\\n```\\r\\nPOST\n.kibana_alerting_cases/_update/<cases-user-actions-id>\\r\\n{\\r\\n\n\\\"script\\\":
{\\r\\n \\\"source\\\":
\\\"\\\"\\\"\\r\\n\nctx._source[\\\"cases-user-actions\\\"].payload.assignees[0].uid
= \\\"\\\";\\r\\n\n\\\"\\\"\\\"\\r\\n }\\r\\n}\\r\\n```\\r\\n\\r\\nAfter
this PR the popup should
**not**\nappear\nanymore.\",\"sha\":\"d8e5cbf67f2bae859a18f956c22205b78d3da5aa\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/207228\",\"number\":207228,\"mergeCommit\":{\"message\":\"Fixed\nan
error with missing uids in the cases detail page
(#207228)\\n\\nFixes\n#206801\\r\\n\\r\\n## Summary\\r\\n\\r\\nWhen
opening the case detail page we\nretrieve user profile info for
the\\r\\ndifferent case user\nactions.\\r\\n\\r\\nIf the uid stored in
ES is an empty string for any of\nthese user\\r\\nactions, we get an
error that looks like\nthis:\\r\\n\\r\\n![Screenshot 2025-01-20 at
12\n34\\r\\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\\r\\n\\r\\n\\r\\n###\nSteps
to reproduce/test (thanks @jcger )\\r\\n\\r\\n1. Create a user with\nthe
`system_indices_superuser` role\\r\\n2. Create a case and assign a\nuser
to it\\r\\n3. Get the ID of the assignment user action from the
case\nabove\\r\\n```\\r\\nGET
.kibana_alerting_cases/_search\\r\\n{\\r\\n \\\"query\\\":\n{\\r\\n
\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n \\\"term\\\":
{\\r\\n \\\"type\\\":\n\\\"cases-user-actions\\\"\\r\\n }\\r\\n },\\r\\n
{\\r\\n \\\"term\\\": {\\r\\n\n\\\"cases-user-actions.type\\\":
\\\"assignees\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n\n\\\"nested\\\":
{\\r\\n \\\"path\\\": \\\"references\\\",\\r\\n \\\"query\\\":
{\\r\\n\n\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n
\\\"term\\\": {\\r\\n\n\\\"references.type\\\": \\\"cases\\\"\\r\\n
}\\r\\n },\\r\\n {\\r\\n \\\"term\\\": {\\r\\n\n\\\"references.id\\\":
\\\"<case_id>\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n
}\\r\\n\n}\\r\\n ]\\r\\n }\\r\\n }\\r\\n}\\r\\n```\\r\\n4. Manually set
the `uid` of the\nassignee to
`\\\"\\\"`\\r\\n```\\r\\nPOST\n.kibana_alerting_cases/_update/<cases-user-actions-id>\\r\\n{\\r\\n\n\\\"script\\\":
{\\r\\n \\\"source\\\":
\\\"\\\"\\\"\\r\\n\nctx._source[\\\"cases-user-actions\\\"].payload.assignees[0].uid
= \\\"\\\";\\r\\n\n\\\"\\\"\\\"\\r\\n }\\r\\n}\\r\\n```\\r\\n\\r\\nAfter
this PR the popup should **not**\nappear
anymore.\",\"sha\":\"d8e5cbf67f2bae859a18f956c22205b78d3da5aa\"}}]}]\nBACKPORT-->\n\nCo-authored-by:
Antonio
<[email protected]>"}},{"branch":"8.16","label":"v8.16.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
adcoelho added a commit that referenced this pull request Jan 23, 2025
…7228) (#208057)

# Backport

This will backport the following commits from `main` to `8.16`:
- [Fixed an error with missing uids in the cases detail page
(#207228)](#207228)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Antonio","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-22T16:15:43Z","message":"Fixed
an error with missing uids in the cases detail page (#207228)\n\nFixes
#206801\r\n\r\n## Summary\r\n\r\nWhen opening the case detail page we
retrieve user profile info for the\r\ndifferent case user
actions.\r\n\r\nIf the uid stored in ES is an empty string for any of
these user\r\nactions, we get an error that looks like
this:\r\n\r\n![Screenshot 2025-01-20 at 12
34\r\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\r\n\r\n\r\n###
Steps to reproduce/test (thanks @jcger )\r\n\r\n1. Create a user with
the `system_indices_superuser` role\r\n2. Create a case and assign a
user to it\r\n3. Get the ID of the assignment user action from the case
above\r\n```\r\nGET .kibana_alerting_cases/_search\r\n{\r\n \"query\":
{\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"type\":
\"cases-user-actions\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"cases-user-actions.type\": \"assignees\"\r\n }\r\n },\r\n {\r\n
\"nested\": {\r\n \"path\": \"references\",\r\n \"query\": {\r\n
\"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n
\"references.type\": \"cases\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"references.id\": \"<case_id>\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n
}\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n4. Manually set the `uid` of the
assignee to `\"\"`\r\n```\r\nPOST
.kibana_alerting_cases/_update/<cases-user-actions-id>\r\n{\r\n
\"script\": {\r\n \"source\": \"\"\"\r\n
ctx._source[\"cases-user-actions\"].payload.assignees[0].uid = \"\";\r\n
\"\"\"\r\n }\r\n}\r\n```\r\n\r\nAfter this PR the popup should **not**
appear
anymore.","sha":"d8e5cbf67f2bae859a18f956c22205b78d3da5aa","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","v9.0.0","Feature:Cases","backport:prev-major","v8.18.0","v8.16.4","v8.17.2"],"title":"Fixed
an error with missing uids in the cases detail
page","number":207228,"url":"https://github.com/elastic/kibana/pull/207228","mergeCommit":{"message":"Fixed
an error with missing uids in the cases detail page (#207228)\n\nFixes
#206801\r\n\r\n## Summary\r\n\r\nWhen opening the case detail page we
retrieve user profile info for the\r\ndifferent case user
actions.\r\n\r\nIf the uid stored in ES is an empty string for any of
these user\r\nactions, we get an error that looks like
this:\r\n\r\n![Screenshot 2025-01-20 at 12
34\r\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\r\n\r\n\r\n###
Steps to reproduce/test (thanks @jcger )\r\n\r\n1. Create a user with
the `system_indices_superuser` role\r\n2. Create a case and assign a
user to it\r\n3. Get the ID of the assignment user action from the case
above\r\n```\r\nGET .kibana_alerting_cases/_search\r\n{\r\n \"query\":
{\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"type\":
\"cases-user-actions\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"cases-user-actions.type\": \"assignees\"\r\n }\r\n },\r\n {\r\n
\"nested\": {\r\n \"path\": \"references\",\r\n \"query\": {\r\n
\"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n
\"references.type\": \"cases\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"references.id\": \"<case_id>\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n
}\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n4. Manually set the `uid` of the
assignee to `\"\"`\r\n```\r\nPOST
.kibana_alerting_cases/_update/<cases-user-actions-id>\r\n{\r\n
\"script\": {\r\n \"source\": \"\"\"\r\n
ctx._source[\"cases-user-actions\"].payload.assignees[0].uid = \"\";\r\n
\"\"\"\r\n }\r\n}\r\n```\r\n\r\nAfter this PR the popup should **not**
appear
anymore.","sha":"d8e5cbf67f2bae859a18f956c22205b78d3da5aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207228","number":207228,"mergeCommit":{"message":"Fixed
an error with missing uids in the cases detail page (#207228)\n\nFixes
#206801\r\n\r\n## Summary\r\n\r\nWhen opening the case detail page we
retrieve user profile info for the\r\ndifferent case user
actions.\r\n\r\nIf the uid stored in ES is an empty string for any of
these user\r\nactions, we get an error that looks like
this:\r\n\r\n![Screenshot 2025-01-20 at 12
34\r\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\r\n\r\n\r\n###
Steps to reproduce/test (thanks @jcger )\r\n\r\n1. Create a user with
the `system_indices_superuser` role\r\n2. Create a case and assign a
user to it\r\n3. Get the ID of the assignment user action from the case
above\r\n```\r\nGET .kibana_alerting_cases/_search\r\n{\r\n \"query\":
{\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"type\":
\"cases-user-actions\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"cases-user-actions.type\": \"assignees\"\r\n }\r\n },\r\n {\r\n
\"nested\": {\r\n \"path\": \"references\",\r\n \"query\": {\r\n
\"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n
\"references.type\": \"cases\"\r\n }\r\n },\r\n {\r\n \"term\": {\r\n
\"references.id\": \"<case_id>\"\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n
}\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n4. Manually set the `uid` of the
assignee to `\"\"`\r\n```\r\nPOST
.kibana_alerting_cases/_update/<cases-user-actions-id>\r\n{\r\n
\"script\": {\r\n \"source\": \"\"\"\r\n
ctx._source[\"cases-user-actions\"].payload.assignees[0].uid = \"\";\r\n
\"\"\"\r\n }\r\n}\r\n```\r\n\r\nAfter this PR the popup should **not**
appear
anymore.","sha":"d8e5cbf67f2bae859a18f956c22205b78d3da5aa"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/207873","number":207873,"state":"MERGED","mergeCommit":{"sha":"06af0cf9a340eee1f5678af8797c442834c173e7","message":"[8.x]
Fixed an error with missing uids in the cases detail page (#207228)
(#207873)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.x`:\n- [Fixed an error with missing uids in the cases
detail
page\n(#207228)](https://github.com/elastic/kibana/pull/207228)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT\n[{\"author\":{\"name\":\"Antonio\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2025-01-22T16:15:43Z\",\"message\":\"Fixed\nan
error with missing uids in the cases detail page
(#207228)\\n\\nFixes\n#206801\\r\\n\\r\\n## Summary\\r\\n\\r\\nWhen
opening the case detail page we\nretrieve user profile info for
the\\r\\ndifferent case user\nactions.\\r\\n\\r\\nIf the uid stored in
ES is an empty string for any of\nthese user\\r\\nactions, we get an
error that looks like\nthis:\\r\\n\\r\\n![Screenshot 2025-01-20 at
12\n34\\r\\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\\r\\n\\r\\n\\r\\n###\nSteps
to reproduce/test (thanks @jcger )\\r\\n\\r\\n1. Create a user with\nthe
`system_indices_superuser` role\\r\\n2. Create a case and assign a\nuser
to it\\r\\n3. Get the ID of the assignment user action from the
case\nabove\\r\\n```\\r\\nGET
.kibana_alerting_cases/_search\\r\\n{\\r\\n \\\"query\\\":\n{\\r\\n
\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n \\\"term\\\":
{\\r\\n \\\"type\\\":\n\\\"cases-user-actions\\\"\\r\\n }\\r\\n },\\r\\n
{\\r\\n \\\"term\\\": {\\r\\n\n\\\"cases-user-actions.type\\\":
\\\"assignees\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n\n\\\"nested\\\":
{\\r\\n \\\"path\\\": \\\"references\\\",\\r\\n \\\"query\\\":
{\\r\\n\n\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n
\\\"term\\\": {\\r\\n\n\\\"references.type\\\": \\\"cases\\\"\\r\\n
}\\r\\n },\\r\\n {\\r\\n \\\"term\\\": {\\r\\n\n\\\"references.id\\\":
\\\"<case_id>\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n
}\\r\\n\n}\\r\\n ]\\r\\n }\\r\\n }\\r\\n}\\r\\n```\\r\\n4. Manually set
the `uid` of the\nassignee to
`\\\"\\\"`\\r\\n```\\r\\nPOST\n.kibana_alerting_cases/_update/<cases-user-actions-id>\\r\\n{\\r\\n\n\\\"script\\\":
{\\r\\n \\\"source\\\":
\\\"\\\"\\\"\\r\\n\nctx._source[\\\"cases-user-actions\\\"].payload.assignees[0].uid
= \\\"\\\";\\r\\n\n\\\"\\\"\\\"\\r\\n }\\r\\n}\\r\\n```\\r\\n\\r\\nAfter
this PR the popup should
**not**\nappear\nanymore.\",\"sha\":\"d8e5cbf67f2bae859a18f956c22205b78d3da5aa\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.18.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"bug\",\"release_note:skip\",\"Team:ResponseOps\",\"v9.0.0\",\"Feature:Cases\",\"backport:prev-minor\"],\"title\":\"Fixed\nan
error with missing uids in the cases
detail\npage\",\"number\":207228,\"url\":\"https://github.com/elastic/kibana/pull/207228\",\"mergeCommit\":{\"message\":\"Fixed\nan
error with missing uids in the cases detail page
(#207228)\\n\\nFixes\n#206801\\r\\n\\r\\n## Summary\\r\\n\\r\\nWhen
opening the case detail page we\nretrieve user profile info for
the\\r\\ndifferent case user\nactions.\\r\\n\\r\\nIf the uid stored in
ES is an empty string for any of\nthese user\\r\\nactions, we get an
error that looks like\nthis:\\r\\n\\r\\n![Screenshot 2025-01-20 at
12\n34\\r\\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\\r\\n\\r\\n\\r\\n###\nSteps
to reproduce/test (thanks @jcger )\\r\\n\\r\\n1. Create a user with\nthe
`system_indices_superuser` role\\r\\n2. Create a case and assign a\nuser
to it\\r\\n3. Get the ID of the assignment user action from the
case\nabove\\r\\n```\\r\\nGET
.kibana_alerting_cases/_search\\r\\n{\\r\\n \\\"query\\\":\n{\\r\\n
\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n \\\"term\\\":
{\\r\\n \\\"type\\\":\n\\\"cases-user-actions\\\"\\r\\n }\\r\\n },\\r\\n
{\\r\\n \\\"term\\\": {\\r\\n\n\\\"cases-user-actions.type\\\":
\\\"assignees\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n\n\\\"nested\\\":
{\\r\\n \\\"path\\\": \\\"references\\\",\\r\\n \\\"query\\\":
{\\r\\n\n\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n
\\\"term\\\": {\\r\\n\n\\\"references.type\\\": \\\"cases\\\"\\r\\n
}\\r\\n },\\r\\n {\\r\\n \\\"term\\\": {\\r\\n\n\\\"references.id\\\":
\\\"<case_id>\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n
}\\r\\n\n}\\r\\n ]\\r\\n }\\r\\n }\\r\\n}\\r\\n```\\r\\n4. Manually set
the `uid` of the\nassignee to
`\\\"\\\"`\\r\\n```\\r\\nPOST\n.kibana_alerting_cases/_update/<cases-user-actions-id>\\r\\n{\\r\\n\n\\\"script\\\":
{\\r\\n \\\"source\\\":
\\\"\\\"\\\"\\r\\n\nctx._source[\\\"cases-user-actions\\\"].payload.assignees[0].uid
= \\\"\\\";\\r\\n\n\\\"\\\"\\\"\\r\\n }\\r\\n}\\r\\n```\\r\\n\\r\\nAfter
this PR the popup should
**not**\nappear\nanymore.\",\"sha\":\"d8e5cbf67f2bae859a18f956c22205b78d3da5aa\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/207228\",\"number\":207228,\"mergeCommit\":{\"message\":\"Fixed\nan
error with missing uids in the cases detail page
(#207228)\\n\\nFixes\n#206801\\r\\n\\r\\n## Summary\\r\\n\\r\\nWhen
opening the case detail page we\nretrieve user profile info for
the\\r\\ndifferent case user\nactions.\\r\\n\\r\\nIf the uid stored in
ES is an empty string for any of\nthese user\\r\\nactions, we get an
error that looks like\nthis:\\r\\n\\r\\n![Screenshot 2025-01-20 at
12\n34\\r\\n54](https://github.com/user-attachments/assets/175c6920-a4fb-4588-9668-1ba7d73f14f3)\\r\\n\\r\\n\\r\\n###\nSteps
to reproduce/test (thanks @jcger )\\r\\n\\r\\n1. Create a user with\nthe
`system_indices_superuser` role\\r\\n2. Create a case and assign a\nuser
to it\\r\\n3. Get the ID of the assignment user action from the
case\nabove\\r\\n```\\r\\nGET
.kibana_alerting_cases/_search\\r\\n{\\r\\n \\\"query\\\":\n{\\r\\n
\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n \\\"term\\\":
{\\r\\n \\\"type\\\":\n\\\"cases-user-actions\\\"\\r\\n }\\r\\n },\\r\\n
{\\r\\n \\\"term\\\": {\\r\\n\n\\\"cases-user-actions.type\\\":
\\\"assignees\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n\n\\\"nested\\\":
{\\r\\n \\\"path\\\": \\\"references\\\",\\r\\n \\\"query\\\":
{\\r\\n\n\\\"bool\\\": {\\r\\n \\\"filter\\\": [\\r\\n {\\r\\n
\\\"term\\\": {\\r\\n\n\\\"references.type\\\": \\\"cases\\\"\\r\\n
}\\r\\n },\\r\\n {\\r\\n \\\"term\\\": {\\r\\n\n\\\"references.id\\\":
\\\"<case_id>\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n }\\r\\n
}\\r\\n\n}\\r\\n ]\\r\\n }\\r\\n }\\r\\n}\\r\\n```\\r\\n4. Manually set
the `uid` of the\nassignee to
`\\\"\\\"`\\r\\n```\\r\\nPOST\n.kibana_alerting_cases/_update/<cases-user-actions-id>\\r\\n{\\r\\n\n\\\"script\\\":
{\\r\\n \\\"source\\\":
\\\"\\\"\\\"\\r\\n\nctx._source[\\\"cases-user-actions\\\"].payload.assignees[0].uid
= \\\"\\\";\\r\\n\n\\\"\\\"\\\"\\r\\n }\\r\\n}\\r\\n```\\r\\n\\r\\nAfter
this PR the popup should **not**\nappear
anymore.\",\"sha\":\"d8e5cbf67f2bae859a18f956c22205b78d3da5aa\"}}]}]\nBACKPORT-->\n\nCo-authored-by:
Antonio
<[email protected]>"}},{"branch":"8.16","label":"v8.16.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants