Skip to content

[Defend for containers] cloud_defend plugin UI boilerplate#151533

Merged
mitodrummer merged 35 commits intoelastic:mainfrom
mitodrummer:cloud_defend_manage_ui_bootstrap
Mar 1, 2023
Merged

[Defend for containers] cloud_defend plugin UI boilerplate#151533
mitodrummer merged 35 commits intoelastic:mainfrom
mitodrummer:cloud_defend_manage_ui_bootstrap

Conversation

@mitodrummer
Copy link
Copy Markdown
Contributor

@mitodrummer mitodrummer commented Feb 16, 2023

Summary

This PR aims to create a footprint in the "security_solution" manage page for the new cloud_defend integration (and kibana plugin). Most of the changes are taken from the cloud_security_posture plugin architecture. The following additions have been made:

  • "Cloud security posture" category in manage page now includes a link to a new "Defend for containers" policies page (I originally created a new category for cloud_defend, but having two full categories with a single link is kind of a waste of real estate).
  • Cloud defend page wrapper to handle empty states, and the flows for when the integration is not yet installed, or user doesn't have cloud enterprise subscription.
  • Basic policies page to serve as a baseline for future detail around each cloud_defend integration (e.g selector / response / alert counts).
  • Application router and sub plugin tie'ins to security_solution.

Apologies in advance for the large PR :)

Screenshots

Manage link
image

Policies page
image

Checklist

Delete any items that are not applicable to this PR.

@mitodrummer mitodrummer added release_note:skip Skip the PR/issue when compiling release notes Team: Cloud Native Integrations v8.8.0 labels Feb 16, 2023
@mitodrummer mitodrummer marked this pull request as ready for review February 21, 2023 21:09
@mitodrummer mitodrummer requested review from a team as code owners February 21, 2023 21:09
@mitodrummer mitodrummer requested review from a team, ashokaditya and joeypoon February 21, 2023 21:10
Copy link
Copy Markdown
Contributor

@JordanSh JordanSh left a comment

Choose a reason for hiding this comment

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

Changes in cloud security posture LGTM 👌

Copy link
Copy Markdown
Contributor

@Tacklebox Tacklebox left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Copy Markdown
Contributor

@jamster10 jamster10 left a comment

Choose a reason for hiding this comment

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

Code looks good for explore. @semd, you may want to peak at it too though

Copy link
Copy Markdown
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

@mitodrummer The implementation overall looks great!
I wrote a couple of comments.
Also, when testing it I am seeing this error when I do not have the package installed:

cloud_defend

And the server throws:

[ERROR][plugins.cloudDefend] PackageNotFoundError: [cloud_defend] package not found in registry
    at fetchFindLatestPackageOrThrow (index.ts:150:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 2)
    at getCloudDefendStatus (status.ts:110:7)
    at status.ts:183:24
    at Router.handle (router.ts:192:30)
    at handler (router.ts:147:13)
    at exports.Manager.execute .
...

Is there any onboarding screen? Otherwise, probably we should check if cloud_defend is enabled and hide all links if not.

@mitodrummer
Copy link
Copy Markdown
Contributor Author

mitodrummer commented Feb 28, 2023

@mitodrummer The implementation overall looks great! I wrote a couple of comments. Also, when testing it I am seeing this error when I do not have the package installed:

cloud_defend

And the server throws:

[ERROR][plugins.cloudDefend] PackageNotFoundError: [cloud_defend] package not found in registry
    at fetchFindLatestPackageOrThrow (index.ts:150:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 2)
    at getCloudDefendStatus (status.ts:110:7)
    at status.ts:183:24
    at Router.handle (router.ts:192:30)
    at handler (router.ts:147:13)
    at exports.Manager.execute .
...

Is there any onboarding screen? Otherwise, probably we should check if cloud_defend is enabled and hide all links if not.

Yea, next step is to sort out some stuff with our integration and getting an updated version to EPR. That should fix the issue you are seeing. This is happening since our package is "beta" (e.g version < 1.0.0). I have updates queued to push out our first 1.0.0 version this week, so should be resolved soon.

@kibana-ci
Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Tests #2 / Rules selection should correctly update the selection label when rules are bulk selected and then unselected via the table select all checkbox

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cloudDefend 59 108 +49
securitySolution 3723 3727 +4
total +53

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
cloudDefend 2 4 +2

Async chunks

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

id before after diff
cloudDefend 226.7KB 245.9KB +19.2KB
securitySolution 15.7MB 15.7MB +3.0KB
total +22.2KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
cloudDefend 0 1 +1

Page load bundle

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

id before after diff
cloudDefend 3.6KB 8.5KB +4.9KB
securitySolution 53.2KB 53.5KB +310.0B
total +5.2KB
Unknown metric groups

API count

id before after diff
cloudDefend 2 15 +13

async chunk count

id before after diff
cloudDefend 3 4 +1

ESLint disabled in files

id before after diff
cloudDefend 0 1 +1

ESLint disabled line counts

id before after diff
cloudDefend 4 6 +2
securitySolution 428 430 +2
total +4

Total ESLint disabled count

id before after diff
cloudDefend 4 7 +3
securitySolution 506 508 +2
total +5

History

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

@mitodrummer mitodrummer merged commit d783aae into elastic:main Mar 1, 2023
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Mar 1, 2023
@semd
Copy link
Copy Markdown
Contributor

semd commented Mar 1, 2023

@mitodrummer

Yea, next step is to sort out some stuff with our integration and getting an updated version to EPR. That should fix the issue you are seeing. This is happening since our package is "beta" (e.g version < 1.0.0). I have updates queued to push out our first 1.0.0 version this week, so should be resolved soon

Okay sounds good, but the question is:
Will there be any situation in which we want to hide the links to cloud_defend? like not having the package installed or missing the license/permission to see the page?

@mitodrummer
Copy link
Copy Markdown
Contributor Author

@mitodrummer

Yea, next step is to sort out some stuff with our integration and getting an updated version to EPR. That should fix the issue you are seeing. This is happening since our package is "beta" (e.g version < 1.0.0). I have updates queued to push out our first 1.0.0 version this week, so should be resolved soon

Okay sounds good, but the question is: Will there be any situation in which we want to hide the links to cloud_defend? like not having the package installed or missing the license/permission to see the page?

This is handled now by the cloud_defend_page component. It will show empty state with button to install integration if not installed, and also handle license checks.

@semd
Copy link
Copy Markdown
Contributor

semd commented Mar 2, 2023

@mitodrummer

Yea, next step is to sort out some stuff with our integration and getting an updated version to EPR. That should fix the issue you are seeing. This is happening since our package is "beta" (e.g version < 1.0.0). I have updates queued to push out our first 1.0.0 version this week, so should be resolved soon

Okay sounds good, but the question is: Will there be any situation in which we want to hide the links to cloud_defend? like not having the package installed or missing the license/permission to see the page?

This is handled now by the cloud_defend_page component. It will show empty state with button to install integration if not installed, and also handle license checks.

Great! Just FYI, if we ever have to make a cloud_defend link inaccessible under some condition, it has to be done here:

export const getManagementFilteredLinks = async (

Thanks!

bmorelli25 pushed a commit to bmorelli25/kibana that referenced this pull request Mar 10, 2023
…51533)

## Summary

This PR aims to create a footprint in the "security_solution" manage
page for the new cloud_defend integration (and kibana plugin). Most of
the changes are taken from the cloud_security_posture plugin
architecture. The following additions have been made:
- "Cloud security posture" category in manage page now includes a link
to a new "Defend for containers" policies page (I originally created a
new category for cloud_defend, but having two full categories with a
single link is kind of a waste of real estate).
- Cloud defend page wrapper to handle empty states, and the flows for
when the integration is not yet installed, or user doesn't have cloud
enterprise subscription.
- Basic policies page to serve as a baseline for future detail around
each cloud_defend integration (e.g selector / response / alert counts).
- Application router and sub plugin tie'ins to security_solution.

*Apologies in advance for the large PR :)*

### Screenshots

Manage link

![image](https://user-images.githubusercontent.com/16198204/219512810-37f03d1b-0170-49e8-b5be-64b5b6ae20df.png)

Policies page

![image](https://user-images.githubusercontent.com/16198204/219512772-a68fbb6d-4a30-439b-a11d-9ac2c95c8bda.png)


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@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 PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v8.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants