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] Move endpointdetails into its own middleware function #107632

Merged
merged 6 commits into from
Aug 9, 2021

Conversation

academo
Copy link
Contributor

@academo academo commented Aug 4, 2021

Summary

This is the first of a small series of PRs to decouple the endpoint details flyout from its current place in the endpoints tab.

This PR Refactors the endpoint middleware by splitting the main big middleware function into smaller ones.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@academo academo added auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.15.0 v8.0.0 labels Aug 4, 2021
@academo academo marked this pull request as ready for review August 4, 2021 12:23
@academo academo requested a review from a team as a code owner August 4, 2021 12:23
@academo academo requested review from pzl and paul-tavares August 4, 2021 12:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt)

@pzl pzl removed their request for review August 5, 2021 17:54
Copy link
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

This looks good to me - thank you for breaking it up.

Can you check if we can remove the ESLint disabled rule for complexity on line 88 now that this is main middleware function is allot simpler?

@academo academo enabled auto-merge (squash) August 9, 2021 09:58
@academo academo disabled auto-merge August 9, 2021 10:54
@academo
Copy link
Contributor Author

academo commented Aug 9, 2021

This looks good to me - thank you for breaking it up.

Can you check if we can remove the ESLint disabled rule for complexity on line 88 now that this is main middleware function is allot simpler?

Yes. I pushed the last bit to remove it.

@academo academo enabled auto-merge (squash) August 9, 2021 11:04
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / Chrome UI Functional Tests.test/functional/apps/management/_index_pattern_create_delete·js.management creating and deleting default index validation can display errors

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 11 times on tracked branches: https://github.com/elastic/kibana/issues/107831

[00:00:00]       │
[00:00:00]         └-: management
[00:00:00]           └-> "before all" hook in "management"
[00:00:00]           └-> "before all" hook in "management"
[00:00:00]             │ info [test/functional/fixtures/es_archiver/logstash_functional] Unloading indices from "mappings.json"
[00:00:00]             │ info [test/functional/fixtures/es_archiver/logstash_functional] Unloading indices from "data.json.gz"
[00:00:01]             │ info [test/functional/fixtures/es_archiver/makelogs] Loading "mappings.json"
[00:00:01]             │ info [test/functional/fixtures/es_archiver/makelogs] Loading "data.json.gz"
[00:00:01]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [logstash-2015.09.17] creating index, cause [api], templates [], shards [1]/[0]
[00:00:01]             │ info [o.e.c.r.a.AllocationService] [node-01] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[logstash-2015.09.17][0]]])." previous.health="YELLOW" reason="shards started [[logstash-2015.09.17][0]]"
[00:00:01]             │ info [test/functional/fixtures/es_archiver/makelogs] Created index "logstash-2015.09.17"
[00:00:01]             │ debg [test/functional/fixtures/es_archiver/makelogs] "logstash-2015.09.17" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:00:01]             │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [logstash-2015.09.18] creating index, cause [api], templates [], shards [1]/[0]
[00:00:01]             │ info [o.e.c.r.a.AllocationService] [node-01] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[logstash-2015.09.18][0]]])." previous.health="YELLOW" reason="shards started [[logstash-2015.09.18][0]]"
[00:00:01]             │ info [test/functional/fixtures/es_archiver/makelogs] Created index "logstash-2015.09.18"
[00:00:01]             │ debg [test/functional/fixtures/es_archiver/makelogs] "logstash-2015.09.18" settings {"index":{"analysis":{"analyzer":{"url":{"max_token_length":"1000","tokenizer":"uax_url_email","type":"standard"}}},"number_of_replicas":"0","number_of_shards":"1"}}
[00:00:01]             │ info [test/functional/fixtures/es_archiver/makelogs] Indexed 101 docs into "logstash-2015.09.17"
[00:00:01]             │ info [test/functional/fixtures/es_archiver/makelogs] Indexed 301 docs into "logstash-2015.09.18"
[00:00:02]           └-: 
[00:00:02]             └-> "before all" hook in ""
[00:00:26]             └-: creating and deleting default index
[00:00:26]               └-> "before all" hook in "creating and deleting default index"
[00:00:26]               └-> "before all" hook in "creating and deleting default index"
[00:00:26]                 │ debg replacing kibana config doc: {}
[00:00:27]                 │ debg navigating to settings url: http://localhost:6131/app/management
[00:00:27]                 │ debg navigate to: http://localhost:6131/app/management
[00:00:27]                 │ debg browser[INFO] http://localhost:6131/app/management?_t=1628509878576 281 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:00:27]                 │
[00:00:27]                 │ debg browser[INFO] http://localhost:6131/bootstrap.js 41:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:00:27]                 │ debg ... sleep(700) start
[00:00:27]                 │ debg ... sleep(700) end
[00:00:27]                 │ debg returned from get, calling refresh
[00:00:28]                 │ debg browser[INFO] http://localhost:6131/app/management?_t=1628509878576 281 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:00:28]                 │
[00:00:28]                 │ debg browser[INFO] http://localhost:6131/bootstrap.js 41:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:00:29]                 │ debg currentUrl = http://localhost:6131/app/management
[00:00:29]                 │          appUrl = http://localhost:6131/app/management
[00:00:29]                 │ debg TestSubjects.find(kibanaChrome)
[00:00:29]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:00:29]                 │ debg ... sleep(501) start
[00:00:29]                 │ debg ... sleep(501) end
[00:00:29]                 │ debg in navigateTo url = http://localhost:6131/app/management
[00:00:29]                 │ debg clickKibanaIndexPatterns link
[00:00:30]                 │ debg TestSubjects.click(indexPatterns)
[00:00:30]                 │ debg Find.clickByCssSelector('[data-test-subj="indexPatterns"]') with timeout=10000
[00:00:30]                 │ debg Find.findByCssSelector('[data-test-subj="indexPatterns"]') with timeout=10000
[00:00:30]                 │ debg isGlobalLoadingIndicatorVisible
[00:00:30]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:00:30]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:00:31]                 │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:00:32]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:00:32]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:00:34]               └-: validation
[00:00:34]                 └-> "before all" hook for "can display errors"
[00:00:34]                 └-> can display errors
[00:00:34]                   └-> "before each" hook: global before each for "can display errors"
[00:00:34]                   │ debg TestSubjects.exists(createIndexPatternButtonFlyout)
[00:00:34]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="createIndexPatternButtonFlyout"]') with timeout=2500
[00:00:37]                   │ debg --- retry.tryForTime error: [data-test-subj="createIndexPatternButtonFlyout"] is not displayed
[00:00:37]                   │ debg TestSubjects.exists(createIndexPatternButton)
[00:00:37]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="createIndexPatternButton"]') with timeout=2500
[00:00:37]                   │ debg TestSubjects.click(createIndexPatternButton)
[00:00:37]                   │ debg Find.clickByCssSelector('[data-test-subj="createIndexPatternButton"]') with timeout=10000
[00:00:37]                   │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternButton"]') with timeout=10000
[00:00:37]                   │ debg TestSubjects.exists(createIndexPatternButtonFlyout)
[00:00:37]                   │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="createIndexPatternButtonFlyout"]') with timeout=2500
[00:00:37]                   │ debg TestSubjects.click(createIndexPatternButtonFlyout)
[00:00:37]                   │ debg Find.clickByCssSelector('[data-test-subj="createIndexPatternButtonFlyout"]') with timeout=10000
[00:00:37]                   │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternButtonFlyout"]') with timeout=10000
[00:00:37]                   │ debg setIndexPatternField(log*)
[00:00:37]                   │ debg TestSubjects.find(createIndexPatternNameInput)
[00:00:37]                   │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternNameInput"]') with timeout=10000
[00:00:38]                   │ debg setIndexPatternField set to log*
[00:00:38]                   │ debg TestSubjects.find(saveIndexPatternButton)
[00:00:38]                   │ debg Find.findByCssSelector('[data-test-subj="saveIndexPatternButton"]') with timeout=10000
[00:00:38]                   │ debg Find.findByClassName('euiFormErrorText') with timeout=10000
[00:00:48]                   │ info Taking screenshot "/dev/shm/workspace/parallel/3/kibana/test/functional/screenshots/failure/management  creating and deleting default index validation can display errors.png"
[00:00:48]                   │ info Current URL is: http://localhost:6131/app/management/kibana/indexPatterns/patterns/22c236a0-f908-11eb-8e44-c133e9a2ec48#/?_a=(tab:indexedFields)
[00:00:48]                   │ info Saving page source to: /dev/shm/workspace/parallel/3/kibana/test/functional/failure_debug/html/management  creating and deleting default index validation can display errors.html
[00:00:48]                   └- ✖ fail: management  creating and deleting default index validation can display errors
[00:00:48]                   │      TimeoutError: Waiting for element to be located By(css selector, .euiFormErrorText)
[00:00:48]                   │ Wait timed out after 10017ms
[00:00:48]                   │       at /dev/shm/workspace/parallel/3/kibana/node_modules/selenium-webdriver/lib/webdriver.js:842:17
[00:00:48]                   │       at runMicrotasks (<anonymous>)
[00:00:48]                   │       at processTicksAndRejections (internal/process/task_queues.js:95:5)
[00:00:48]                   │ 
[00:00:48]                   │ 

Stack Trace

TimeoutError: Waiting for element to be located By(css selector, .euiFormErrorText)
Wait timed out after 10017ms
    at /dev/shm/workspace/parallel/3/kibana/node_modules/selenium-webdriver/lib/webdriver.js:842:17
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  remoteStacktrace: ''
}

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
securitySolution 6.5MB 6.5MB +768.0B
Unknown metric groups

References to deprecated APIs

id before after diff
securitySolution 832 834 +2

History

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

@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

ashokaditya added a commit that referenced this pull request Aug 16, 2021
… correctly (#108551)

* update endpoint middleware to load data correctly

fixes kibana/issues/108497
modifies changes done in /pull/107632
and /pull/108330

* await results

fixes /issues/108497

* review comments

* Add a test to cover this case

fixes /issues/108497

Co-authored-by: Kibana Machine <[email protected]>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Aug 16, 2021
… correctly (elastic#108551)

* update endpoint middleware to load data correctly

fixes kibana/issues/108497
modifies changes done in elastic/pull/107632
and elastic/pull/108330

* await results

fixes elastic/issues/108497

* review comments

* Add a test to cover this case

fixes elastic/issues/108497

Co-authored-by: Kibana Machine <[email protected]>
kibanamachine added a commit that referenced this pull request Aug 16, 2021
… correctly (#108551) (#108678)

* update endpoint middleware to load data correctly

fixes kibana/issues/108497
modifies changes done in /pull/107632
and /pull/108330

* await results

fixes /issues/108497

* review comments

* Add a test to cover this case

fixes /issues/108497

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Ashokaditya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants