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][Endpoint] Add additional tests for Policy Response #154505

Merged

Conversation

paul-tavares
Copy link
Contributor

@paul-tavares paul-tavares commented Apr 5, 2023

Summary

  • Adds Cypress tests to validate that recent Policy response errors are bubbled up and shown in Fleet Agent Details.
  • Updated Fleet Agent Details display of Integrations with data-test-subj's for testing

In support of the above, the following was also introduced:

  • New standalone EndpointPolicyResponseGenerator which also includes one specific method to retrieve a "connect kernel failure"
  • New data loaders for Endpoint Policy Responses
  • Endpoint Emulator CLI was enhanced with a new panel that allows sending policy responses to specific endpoints
  • Added EndpointMetadataGenerator.custom() static method
    • Creates a custom EndpointMetadataGenerator subclass based on input arguments. allows for easier customization of generated endpoint hosts
    • currently supports setting Host OS and Agent version
  • Like the above, added EndpointDocGenerator.custom() which currently allow for setting a custom endpoint generator for use internally
  • Added version and os to indexEndpointHosts cypress task
  • new cypress tasks:
    • indexEndpointPolicyResponse - load a policy response
    • deleteIndexedEndpointPolicyResponse - delete previously loaded policy response

@paul-tavares paul-tavares added release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.8.0 labels Apr 5, 2023
@paul-tavares paul-tavares self-assigned this Apr 5, 2023
@paul-tavares paul-tavares marked this pull request as ready for review April 11, 2023 20:43
@paul-tavares paul-tavares requested review from a team as code owners April 11, 2023 20:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

@paul-tavares paul-tavares requested review from dasansol92 and removed request for ashokaditya April 11, 2023 20:43
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 11, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Fleet change 🚀

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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
fleet 943.2KB 943.6KB +416.0B
Unknown metric groups

ESLint disabled in files

id before after diff
securitySolution 79 80 +1

ESLint disabled line counts

id before after diff
securitySolution 433 436 +3

Total ESLint disabled count

id before after diff
securitySolution 512 516 +4

History

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

cc @paul-tavares

Copy link
Contributor

@dasansol92 dasansol92 left a comment

Choose a reason for hiding this comment

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

Looks good to go. Left a question and suggestion but nothing that should block you merging this. 🔥

@@ -0,0 +1,94 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Got curious, why is this in the mocked_data folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there was no need to actually have a real endpoint for this test, thus I did not include it in the other endpoint suite. Also, the "real endpoint" test suite does not run in CI (yet 🤞 )

@@ -0,0 +1,220 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a bit of explanation here about what this file does and how it works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll add it in a subsequent PR.

Essentially, it displays a CLI screen that allows you to set a host and then send it a customized policy response action.

return mergeWith(destinationObj, srcObj, customizer);
};

export class EndpointPolicyResponseGenerator extends BaseDataGenerator {
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome!

@paul-tavares paul-tavares merged commit d6a8a88 into elastic:main Apr 13, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 13, 2023
@paul-tavares paul-tavares deleted the task/olm-6033-policy-response-tests branch April 13, 2023 13:24
saarikabhasi pushed a commit to saarikabhasi/kibana that referenced this pull request Apr 19, 2023
elastic#154505)

## Summary

- Adds Cypress tests to validate that recent Policy response errors are
bubbled up and shown in Fleet Agent Details.
- Updated Fleet Agent Details display of Integrations with
`data-test-subj`'s for testing

In support of the above, the following was also introduced:

- New standalone `EndpointPolicyResponseGenerator` which also includes
one specific method to retrieve a "connect kernel failure"
- New data loaders for Endpoint Policy Responses
- Endpoint Emulator CLI was enhanced with a new panel that allows
sending policy responses to specific endpoints
- Added `EndpointMetadataGenerator.custom()` static method
- Creates a custom `EndpointMetadataGenerator` subclass based on input
arguments. allows for easier customization of generated endpoint hosts
    - currently supports setting Host OS and Agent version
- Like the above, added `EndpointDocGenerator.custom()` which currently
allow for setting a custom endpoint generator for use internally
- Added `version` and `os` to  `indexEndpointHosts` cypress task
- new cypress tasks:
   - `indexEndpointPolicyResponse` - load a policy response
- `deleteIndexedEndpointPolicyResponse` - delete previously loaded
policy response
-
ashokaditya added a commit to ashokaditya/kibana that referenced this pull request Jul 10, 2023
indexing host timeout has been increased in elastic/pull/159518
added in elastic/pull/154505
skipped in elastic/pull/156104
ashokaditya added a commit to ashokaditya/kibana that referenced this pull request Jul 10, 2023
indexing host timeout has been increased in elastic/pull/159518
added in elastic/pull/154505
skipped in elastic/pull/156104
ashokaditya added a commit to ashokaditya/kibana that referenced this pull request Jul 11, 2023
indexing host timeout has been increased in elastic/pull/159518
added in elastic/pull/154505
skipped in elastic/pull/156104
ashokaditya added a commit that referenced this pull request Jul 11, 2023
## Summary

Unskip test that was timing out at indexing test hosts. 
The timeout has since been increased in /pull/159518

Was added in /pull/154505 and skipped in
/pull/156104
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 11, 2023
## Summary

Unskip test that was timing out at indexing test hosts.
The timeout has since been increased in elastic/pull/159518

Was added in elastic/pull/154505 and skipped in
elastic/pull/156104

(cherry picked from commit 5d06694)
kibanamachine added a commit that referenced this pull request Jul 11, 2023
# Backport

This will backport the following commits from `main` to `8.9`:
- [[Defend Workflows] Unskip policy response test
(#161588)](#161588)

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

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

<!--BACKPORT
[{"author":{"name":"Ashokaditya","email":"1849116+ashokaditya@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-07-11T11:58:42Z","message":"[Defend
Workflows] Unskip policy response test (#161588)\n\n##
Summary\r\n\r\nUnskip test that was timing out at indexing test hosts.
\r\nThe timeout has since been increased in
/pull/159518\r\n\r\nWas added in
/pull/154505 and skipped
in\r\nelastic/kibana/pull/156104","sha":"5d066944fcef558eacc858bb807acb2fb783eaee","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","OLM
Sprint","v8.9.0","v8.10.0"],"number":161588,"url":"#161588
Workflows] Unskip policy response test (#161588)\n\n##
Summary\r\n\r\nUnskip test that was timing out at indexing test hosts.
\r\nThe timeout has since been increased in
/pull/159518\r\n\r\nWas added in
/pull/154505 and skipped
in\r\nelastic/kibana/pull/156104","sha":"5d066944fcef558eacc858bb807acb2fb783eaee"}},"sourceBranch":"main","suggestedTargetBranches":["8.9"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"#161588
Workflows] Unskip policy response test (#161588)\n\n##
Summary\r\n\r\nUnskip test that was timing out at indexing test hosts.
\r\nThe timeout has since been increased in
/pull/159518\r\n\r\nWas added in
/pull/154505 and skipped
in\r\nelastic/kibana/pull/156104","sha":"5d066944fcef558eacc858bb807acb2fb783eaee"}}]}]
BACKPORT-->

Co-authored-by: Ashokaditya <1849116+ashokaditya@users.noreply.github.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:Defend Workflows “EDR Workflows” sub-team of Security Solution Team:Fleet Team label for Observability Data Collection Fleet team v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants