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] host isolation exceptions listing under policy integration details tab #120361

Merged

Conversation

academo
Copy link
Contributor

@academo academo commented Dec 3, 2021

Summary

Shows a list of related host isolation exceptions to a policy inside the policy settings view:

image

Shows an empty status when no assigned exceptions to the policy:

image

Shows an empty status when no exceptions exists:
image

This PR introduces:

  • The Host isolation exceptions tab on the policy settings tab
  • Unassigned and unexistent state handling
  • Policy-related host isolation exceptions list

To be introduced in follow up PRs:

  • Assign an exception to the policy from the list
  • Unassign an exception to the policy'
  • Permissions and licensing validations

Note: this PR intentionally doesn't cover licensing validations. A follow up PR will be done for that.

Checklist

Delete any items that are not applicable to this PR.

Esteban Beltran added 30 commits November 17, 2021 10:41
@academo academo added release_note:feature Makes this part of the condensed release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.1.0 labels Dec 7, 2021
@elasticmachine
Copy link
Contributor

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

Copy link
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

This new tab is awesome 👍 I have a few questions that I'd like to understand; and a suggestion about reusing an empty state component. 😅

Note: I took this for a spin and noticed that I don't see the Host Isolation exceptions menu item even after adding an exception item. Also, I think it is a bit odd to not see this menu item to start with. It looks especially odd when I'm on the add exception flyout with the correct breadcrumb, but no menu item to match. Not sure if this is being addressed in a later PR.

(Refreshing the whole app did work and shows the new menu item)

Here's what I saw.

image
image

Copy link
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

This new tab is awesome 👍 I have a few questions that I'd like to understand; and a suggestion about reusing an empty state component. 😅

Note: I took this for a spin and noticed that I don't see the Host Isolation exceptions menu item even after adding an exception item. Also, I think it is a bit odd to not see this menu item to start with. It looks especially odd when I'm on the add exception flyout with the correct breadcrumb, but no menu item to match. Not sure if this is being addressed in a later PR.

(Refreshing the whole app did work and shows the new menu item)

Here's what I saw.

image
image

Copy link
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

🚀 🐑

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.

This is looking good!! 🔥 Left some comments (mostly minor ones) 🙂

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.

lgtm! Thanks for do the changes 🔥


const [expandedItemsMap, setExpandedItemsMap] = useState<Map<string, boolean>>(new Map());

const pagination = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion:memoize this in order to prevent unnecessary component re-renders due to shallow diffs


const artifactCardPolicies = useEndpointPoliciesToArtifactPolicies(policiesRequest.data?.items);

const provideCardProps: ArtifactCardGridProps['cardComponentProps'] = (item) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

};
};

const handleExpandCollapse: ArtifactCardGridProps['onExpandCollapse'] = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use useCallback() here?

import { PolicyHostIsolationExceptionsTab } from './host_isolation_exceptions_tab';

jest.mock('../../../host_isolation_exceptions/service');
jest.mock('../../../../../common/components/user_privileges/endpoint/use_endpoint_privileges');
Copy link
Contributor

Choose a reason for hiding this comment

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

I had been trying to remove mocking this "internal" hook to the useUserPrivileges. Any change you can mock that instead and not access this one directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am not really using this mock. I had to mock it because the http request that this component is doing was failing my tests.

@academo
Copy link
Contributor Author

academo commented Dec 13, 2021

@paul-tavares I checked your suggestions for useCallback and memo but they won't make any difference since those values dependencies change basically any time the component has to re-render anyway.

@academo academo enabled auto-merge (squash) December 13, 2021 14:10
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 2812 2816 +4

Async chunks

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

id before after diff
securitySolution 4.6MB 4.6MB +7.3KB

History

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

@academo academo merged commit b675324 into elastic:main Dec 13, 2021
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Dec 13, 2021
TinLe pushed a commit to TinLe/kibana that referenced this pull request Dec 22, 2021
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:feature Makes this part of the condensed release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants