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

[ResponseOps][Cases] Fix case actions bug in serverless security #195281

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

adcoelho
Copy link
Contributor

@adcoelho adcoelho commented Oct 7, 2024

Fixes #186270

Summary

This PR ensures that cases created by the case action in stack management rules in serverless security projects are assigned the correct owner.

How to test

  1. Add the following line to serverless.yml - xpack.cloud.serverless.project_id: test-123
  2. Start elastic search in serverless security mode - yarn es serverless --projectType security
  3. Start Kibana in serverless security mode - yarn start --serverless=security
  4. Go to stack and create a rule with the cases action.
  5. When an alert is triggered confirm you can view the case in Security > Cases

@adcoelho adcoelho added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 Feature:Cases Cases feature backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) v8.16.0 labels Oct 7, 2024
@adcoelho adcoelho self-assigned this Oct 7, 2024
@adcoelho adcoelho requested review from a team as code owners October 7, 2024 15:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #13 / FormBasedDimensionEditor should list all field names and document as a whole in prioritized order

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 491.5KB 491.5KB +20.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 151.1KB 151.2KB +80.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @adcoelho

Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally, was bale to create case in security solution and observability using case action 👍

}): Owner => {
// This is a workaround for a very specific bug with the cases action in serverless security
// More info here: https://github.com/elastic/kibana/issues/186270
if (isServerlessSecurity) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious why we don't need check for o11y.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also curious. Stack cases are not available in o11y. What is the current behavior if you create a stack alert from the stack management page?

Copy link
Contributor Author

@adcoelho adcoelho Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack rules are not available in serverless observability. So this scenario won't happen.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that, thanks!

@adcoelho adcoelho merged commit 02cc5a8 into elastic:main Oct 9, 2024
31 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11256240601

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 9, 2024
…stic#195281)

Fixes elastic#186270

## Summary

This PR ensures that cases created by the case action in stack
management rules in serverless security projects are assigned the
correct owner.

### How to test

1. Add the following line to `serverless.yml` -
`xpack.cloud.serverless.project_id: test-123`
2. Start elastic search in serverless security mode - `yarn es
serverless --projectType security`
3. Start Kibana in serverless security mode - `yarn start
--serverless=security`
4. Go to stack and create a rule with the cases action.
5. When an alert is triggered confirm you can view the case in `Security
> Cases`

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 02cc5a8)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine mentioned this pull request Oct 9, 2024
2 tasks
kibanamachine added a commit that referenced this pull request Oct 9, 2024
#195281) (#195600)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Cases] Fix case actions bug in serverless security
(#195281)](#195281)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT
[{"author":{"name":"Antonio","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-09T13:41:20Z","message":"[ResponseOps][Cases]
Fix case actions bug in serverless security (#195281)\n\nFixes
#186270\r\n\r\n## Summary\r\n\r\nThis PR ensures that cases created by
the case action in stack\r\nmanagement rules in serverless security
projects are assigned the\r\ncorrect owner.\r\n\r\n\r\n### How to
test\r\n\r\n1. Add the following line to `serverless.yml`
-\r\n`xpack.cloud.serverless.project_id: test-123`\r\n2. Start elastic
search in serverless security mode - `yarn es\r\nserverless
--projectType security`\r\n3. Start Kibana in serverless security mode -
`yarn start\r\n--serverless=security`\r\n4. Go to stack and create a
rule with the cases action.\r\n5. When an alert is triggered confirm you
can view the case in `Security\r\n>
Cases`\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"02cc5a83b860713bc61868b766deda2c4e114bda","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.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","v8.16.0"],"title":"[ResponseOps][Cases]
Fix case actions bug in serverless
security","number":195281,"url":"https://github.com/elastic/kibana/pull/195281","mergeCommit":{"message":"[ResponseOps][Cases]
Fix case actions bug in serverless security (#195281)\n\nFixes
#186270\r\n\r\n## Summary\r\n\r\nThis PR ensures that cases created by
the case action in stack\r\nmanagement rules in serverless security
projects are assigned the\r\ncorrect owner.\r\n\r\n\r\n### How to
test\r\n\r\n1. Add the following line to `serverless.yml`
-\r\n`xpack.cloud.serverless.project_id: test-123`\r\n2. Start elastic
search in serverless security mode - `yarn es\r\nserverless
--projectType security`\r\n3. Start Kibana in serverless security mode -
`yarn start\r\n--serverless=security`\r\n4. Go to stack and create a
rule with the cases action.\r\n5. When an alert is triggered confirm you
can view the case in `Security\r\n>
Cases`\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"02cc5a83b860713bc61868b766deda2c4e114bda"}},"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/195281","number":195281,"mergeCommit":{"message":"[ResponseOps][Cases]
Fix case actions bug in serverless security (#195281)\n\nFixes
#186270\r\n\r\n## Summary\r\n\r\nThis PR ensures that cases created by
the case action in stack\r\nmanagement rules in serverless security
projects are assigned the\r\ncorrect owner.\r\n\r\n\r\n### How to
test\r\n\r\n1. Add the following line to `serverless.yml`
-\r\n`xpack.cloud.serverless.project_id: test-123`\r\n2. Start elastic
search in serverless security mode - `yarn es\r\nserverless
--projectType security`\r\n3. Start Kibana in serverless security mode -
`yarn start\r\n--serverless=security`\r\n4. Go to stack and create a
rule with the cases action.\r\n5. When an alert is triggered confirm you
can view the case in `Security\r\n>
Cases`\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>","sha":"02cc5a83b860713bc61868b766deda2c4e114bda"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Antonio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) bug Fixes for quality problems that affect the customer experience Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cases] Case action tries to create stack cases on serverless project where stack case are not available
7 participants