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 ability for users to release an isolated host in serverless tiers where Response Actions are not available #163616

Conversation

paul-tavares
Copy link
Contributor

@paul-tavares paul-tavares commented Aug 10, 2023

Summary

  • Fixes the loading of the Host Isolation sub-feature control into kibana - should always be loaded and includes only the release privilege in it
  • Fixes the "Take action" menu items for Host Isolation (displayed in alert details) to ensure release is displayed when host is isolated and user has release privilege only
  • Endpoint Response console will now NOT be available to users who only have release response action (this is a downgrade scenario where the user is still allowed to release isolated hosts)

@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.10.0 labels Aug 10, 2023
@paul-tavares paul-tavares self-assigned this Aug 10, 2023
// of the response actions with exception of `release`. Sole access to `release` is something
// that is supported for a user in a license downgrade scenario, and in that case we don't want
// to allow access to Response Console.
authz.canAccessResponseConsole =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

enables Response Console access if the user has Authz to any response action with the exception of un-isolate. Users that have only permission to unisolate occurs when the Kibana license is downgraded or in serverless when running a non Endpoint Complete tier. It will allow users to continue to release their isolated hosts if any.

Also - this change here will ensure that as we add more response actions, that access to Response console will continue to pick those up and enable this option.

]
);
return hostIsolationAction;
return canIsolateHost || (isHostIsolated && canUnIsolateHost) ? menuItems : [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes a bug were before it was not showing release in a downgrade scenario.

id: 'host_isolation_all',
includeIn: 'none',
name: 'All',
savedObject: {
all: [],
read: [],
},
// FYI: The current set of values below (`api`, `ui`) cover only `release` response action.
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'm hopping that tidbits of info like this can help along understanding how the framework around loading different privileges into existing Sub-Features

…less-access-to-isolate-release

# Conflicts:
#	x-pack/test_serverless/functional/test_suites/security/cypress/e2e/endpoint_management/roles/complete_with_endpoint_roles.cy.ts
#	x-pack/test_serverless/functional/test_suites/security/cypress/e2e/endpoint_management/roles/essentials_with_endpoint.roles.cy.ts
@paul-tavares paul-tavares marked this pull request as ready for review August 14, 2023 13:40
@paul-tavares paul-tavares requested review from a team as code owners August 14, 2023 13:40
@elasticmachine
Copy link
Contributor

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

@paul-tavares paul-tavares requested review from tomsonpl and removed request for dasansol92 August 14, 2023 13:54
Copy link
Member

@pzl pzl left a comment

Choose a reason for hiding this comment

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

well-commented. Thanks for that, there is a good amount of overlap with licenses and privileges and enabled things that make a complex situation here.

pointed out some typos that were in test names only. All the 'unisolate' or 'release' strings in the code were correct. Though maybe we should make them string constants more so there is no chance of typos

it(`should not allow access to Response Action: ${actionName}`, () => {
ensureResponseActionAuthzAccess('none', actionName, username, password);
});
}

it('should have access to `unisoalte` api', () => {
Copy link
Member

Choose a reason for hiding this comment

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

typo: unisolate

ensureResponseActionAuthzAccess('none', actionName, username, password);
});
}

it('should have access to `unisoalte` api', () => {
Copy link
Member

Choose a reason for hiding this comment

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

copy/paste typo

it(`should not allow access to Response Action: ${actionName}`, () => {
ensureResponseActionAuthzAccess('none', actionName, username, password);
});
}

it('should have access to `unisoalte` api', () => {
Copy link
Member

Choose a reason for hiding this comment

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

typ

@@ -122,6 +124,20 @@ export const calculateEndpointAuthz = (
canWriteEventFilters,
canReadEventFilters,
};

// Response console is only accessible when is license is Enterprise and user has access to any
// of the response actions with exception of `release`. Sole access to `release` is something
Copy link
Member

Choose a reason for hiding this comment

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

nit: ... with the exception to ...

@@ -122,6 +124,20 @@ export const calculateEndpointAuthz = (
canWriteEventFilters,
canReadEventFilters,
};

// Response console is only accessible when is license is Enterprise and user has access to any
Copy link
Member

Choose a reason for hiding this comment

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

nit: ..when license is...


// Response console is only accessible when is license is Enterprise and user has access to any
// of the response actions with exception of `release`. Sole access to `release` is something
// that is supported for a user in a license downgrade scenario, and in that case we don't want
Copy link
Member

Choose a reason for hiding this comment

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

nit: ...in that case, we...

Comment on lines +134 to +138
Object.values(omit(RESPONSE_CONSOLE_ACTION_COMMANDS_TO_REQUIRED_AUTHZ, 'release')).some(
(responseActionAuthzKey) => {
return authz[responseActionAuthzKey];
}
);
Copy link
Member

Choose a reason for hiding this comment

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

🔥

agentStatus,
capabilities,
} = useHostIsolationStatus({
agentId,
});

const isolationSupported = useMemo(() => {
const doesHostSupportIsolation = useMemo(() => {
Copy link
Member

Choose a reason for hiding this comment

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

🔥

const isolateHostHandler = useCallback(() => {
closePopover();
if (isolationStatus === false) {
if (isHostIsolated === false) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: !isHostIsolated

@paul-tavares paul-tavares enabled auto-merge (squash) August 14, 2023 19:11
@kevinlog
Copy link
Contributor

@elasticmachine merge upstream

@kevinlog
Copy link
Contributor

@elasticmachine merge upstream

@paul-tavares paul-tavares merged commit 8366d5f into elastic:main Aug 15, 2023
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Security Solution Cypress Tests #6 / Custom query rules Custom detection rules deletion and edition Deletion Deletes one rule from detail page Deletes one rule from detail page

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 15.6MB 15.6MB -3.6KB

Page load bundle

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

id before after diff
securitySolutionServerless 25.4KB 25.4KB -80.0B

History

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

cc @paul-tavares

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 15, 2023
bryce-b pushed a commit that referenced this pull request Aug 22, 2023
…solated host in serverless tiers where Response Actions are not available (#163616)

## Summary

- Fixes the loading of the Host Isolation sub-feature control into
kibana - should always be loaded and includes only the `release`
privilege in it
- Fixes the "Take action" menu items for Host Isolation (displayed in
alert details) to ensure `release` is displayed when host is isolated
and user has `release` privilege only
- Endpoint Response console will now NOT be available to users who only
have `release` response action (this is a downgrade scenario where the
user is still allowed to `release` isolated hosts)
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 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants