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

[Security Solution] Intercept individual package installation via Fleet #161859

Merged
merged 3 commits into from
Jul 14, 2023

Conversation

jpdjere
Copy link
Contributor

@jpdjere jpdjere commented Jul 13, 2023

Summary

During Cypress tests, intercept POST /api/fleet/epm/packages/security_detection_engine/*.

This is the endpoint used when a specific security_detection_engine package is set to be used via the --xpack.securitySolution.prebuiltRulesPackageVersion config flag, which is used to test by the TRADE team.

This PR updates the test to account for that flow.

For maintainers

@jpdjere jpdjere self-assigned this Jul 13, 2023
@jpdjere jpdjere added test release_note:skip Skip the PR/issue when compiling release notes Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team v8.9.0 labels Jul 13, 2023
@jpdjere jpdjere marked this pull request as ready for review July 13, 2023 13:04
@jpdjere jpdjere requested review from a team as code owners July 13, 2023 13:04
@jpdjere jpdjere requested a review from xcrzx July 13, 2023 13:04
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@jpdjere jpdjere force-pushed the fix-testing-prebuilt-rules branch from 24cc1f3 to 9fadb8d Compare July 13, 2023 13:05
@jpdjere
Copy link
Contributor Author

jpdjere commented Jul 13, 2023

Running the Flaky Test Runner for the SecuritySolution Cypress tests:

https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2629

Copy link
Contributor

@terrancedejesus terrancedejesus left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @jpdjere 🙏🏽

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Tests #7 / Alert details expandable flyout right panel overview tab insights section should display threat intelligence section

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 411 415 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 490 494 +4
total +6

History

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

cc @jpdjere

Copy link
Contributor

@xcrzx xcrzx left a comment

Choose a reason for hiding this comment

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

I've tested it locally using the 8.7.9-beta.1 package, and all the rule installation workflow tests passed. A big thank you to @jpdjere for the fixes 👍

// Under normal flow the package is installed via the Fleet bulk install API.
// However, for testing purposes the package can be installed via the Fleet individual install API,
// so we need to intercept and wait for that request as well.
if (!packagesBulkInstalled.includes('security_detection_engine')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's okay to leave the logic here for now, but for a more robust solution, we should consider introducing an API endpoint on the detection engine side. This endpoint would handle all the complexities of package installation logic internally. We currently have duplication of this logic on both the frontend and backend. That could be part of Serverless: #150587.

@jpdjere jpdjere merged commit 45a483f into elastic:main Jul 14, 2023
@jpdjere jpdjere removed the v8.9.0 label Jul 14, 2023
@kibanamachine kibanamachine added v8.10.0 backport:skip This commit does not require backporting labels Jul 14, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 14, 2023
…et (elastic#161859)

## Summary

During Cypress tests, intercept `POST
/api/fleet/epm/packages/security_detection_engine/*`.

This is the endpoint used when a specific `security_detection_engine`
package is set to be used via the
`--xpack.securitySolution.prebuiltRulesPackageVersion` config flag,
which is used to test by the TRADE team.

This PR updates the test to account for that flow.

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit 45a483f)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.9

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

Questions ?

Please refer to the Backport tool documentation

jpdjere added a commit that referenced this pull request Jul 16, 2023
…ia Fleet (#161859) (#161972)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Security Solution] Intercept individual package installation via
Fleet (#161859)](#161859)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Juan Pablo
Djeredjian","email":"jpdjeredjian@gmail.com"},"sourceCommit":{"committedDate":"2023-07-14T13:49:42Z","message":"[Security
Solution] Intercept individual package installation via Fleet
(#161859)\n\n## Summary\r\n\r\nDuring Cypress tests, intercept
`POST\r\n/api/fleet/epm/packages/security_detection_engine/*`.\r\n\r\nThis
is the endpoint used when a specific
`security_detection_engine`\r\npackage is set to be used via
the\r\n`--xpack.securitySolution.prebuiltRulesPackageVersion` config
flag,\r\nwhich is used to test by the TRADE team.\r\n\r\nThis PR updates
the test to account for that flow.\r\n\r\n### For maintainers\r\n\r\n- [
] This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"45a483f49643bcca4ff130d9f100c38a1a2181e7","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","backport:skip","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","v8.10.0"],"number":161859,"url":"https://github.com/elastic/kibana/pull/161859","mergeCommit":{"message":"[Security
Solution] Intercept individual package installation via Fleet
(#161859)\n\n## Summary\r\n\r\nDuring Cypress tests, intercept
`POST\r\n/api/fleet/epm/packages/security_detection_engine/*`.\r\n\r\nThis
is the endpoint used when a specific
`security_detection_engine`\r\npackage is set to be used via
the\r\n`--xpack.securitySolution.prebuiltRulesPackageVersion` config
flag,\r\nwhich is used to test by the TRADE team.\r\n\r\nThis PR updates
the test to account for that flow.\r\n\r\n### For maintainers\r\n\r\n- [
] This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"45a483f49643bcca4ff130d9f100c38a1a2181e7"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/161859","number":161859,"mergeCommit":{"message":"[Security
Solution] Intercept individual package installation via Fleet
(#161859)\n\n## Summary\r\n\r\nDuring Cypress tests, intercept
`POST\r\n/api/fleet/epm/packages/security_detection_engine/*`.\r\n\r\nThis
is the endpoint used when a specific
`security_detection_engine`\r\npackage is set to be used via
the\r\n`--xpack.securitySolution.prebuiltRulesPackageVersion` config
flag,\r\nwhich is used to test by the TRADE team.\r\n\r\nThis PR updates
the test to account for that flow.\r\n\r\n### For maintainers\r\n\r\n- [
] This was checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"45a483f49643bcca4ff130d9f100c38a1a2181e7"}}]}]
BACKPORT-->

Co-authored-by: Juan Pablo Djeredjian <jpdjeredjian@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. test v8.9.0 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants