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] add new permission properties for endpoint rbac #142243

Merged
merged 2 commits into from
Sep 30, 2022

Conversation

joeypoon
Copy link
Member

Summary

Add properties for new permissions into authz service for endpoint rbac.

Checklist

For maintainers

@joeypoon joeypoon added release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.6.0 labels Sep 29, 2022
@joeypoon joeypoon requested a review from a team as a code owner September 29, 2022 15:54
@elasticmachine
Copy link
Contributor

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

isEndpointRbacEnabled,
hasEndpointManagementAccess,
'readEventFilters'
);

return {
canAccessFleet: fleetAuthz?.fleet.all ?? userRoles.includes('superuser'),
canAccessEndpointManagement: hasEndpointManagementAccess,
Copy link
Member Author

@joeypoon joeypoon Sep 29, 2022

Choose a reason for hiding this comment

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

we're still missing readEndpointList and writeEndpointList. I'm still unsure of the interaction these will have with canAccessEndpointManagement so I left them off for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think canAccessEndpointManagment will be deleted once we move over to RBAC. It made sense only when everthing was tied to superuser.

My suggestion is for you to add the properties for endpoint list and just set them to hasEndpointManagementAccess here for now. I think we had said that for the endpoint metadata api we will likely tie access to ti if hte user has access to security solution, so we'll have to add that in at some point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, deleting canAccessEndpointManagment definitely seems most likely. I can add them in first.

hasEndpointManagementAccess,
'writePolicyManagement'
);
const canReadPolicyManagement = hasPermission(
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment applies for all of the *Read* properties.
I assume the Read properties is what we will check to ensure a user can visit a page or if we display a link in menus to allow the user to visit a given page. If that is correct, should they all be renamed to canAccess* instead? These types of authz properties would indicate that the user has at least read permissions to the page. The write properties would indicate if they are able to create/delete/edit entries in that page and would only further limit the expose of the UI's functionality once they have access to it.

The other change here is on the assignment of its value. There should never be a case where read would be false, but write is true. So I would suggest that when assigning the value to the read properties, we instead do:

const canReadPolicyManagement = canWritePolicyManagement || hasPermission(

Copy link
Contributor

Choose a reason for hiding this comment

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

btw - we can also just keep the *Read* properties if that makes it clearer to the team and maybe helps tie it back to the Kibana feature control UI

Copy link
Member Author

Choose a reason for hiding this comment

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

Not a big deal to me either way but I find read to be clearer than access.

👍 on the suggestion for checking write first, will update that.

hasEndpointManagementAccess,
'readPolicyManagement'
);
const canWriteActionsLogManagement = hasPermission(
Copy link
Contributor

Choose a reason for hiding this comment

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

Confused about this one based on its name. What would be the write functionality?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this is one of the ones where we preemptively did a all | read | none even though all and read are functionally the same due to migration constraints. @kevinlog correct me if I'm wrong.

isEndpointRbacEnabled,
hasEndpointManagementAccess,
'readEventFilters'
);

return {
canAccessFleet: fleetAuthz?.fleet.all ?? userRoles.includes('superuser'),
canAccessEndpointManagement: hasEndpointManagementAccess,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think canAccessEndpointManagment will be deleted once we move over to RBAC. It made sense only when everthing was tied to superuser.

My suggestion is for you to add the properties for endpoint list and just set them to hasEndpointManagementAccess here for now. I think we had said that for the endpoint metadata api we will likely tie access to ti if hte user has access to security solution, so we'll have to add that in at some point.

@joeypoon joeypoon force-pushed the chore/rbac-properties branch from 9bc6d0d to 59db0ab Compare September 29, 2022 21:07
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.

looks good. 👍

@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
securitySolution 6.6MB 6.6MB +1.2KB

History

  • 💚 Build #76924 succeeded 9bc6d0d6d0e4800b13ad2e035d6b34bd49cfe96d

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

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 this!! 🚀

@joeypoon joeypoon merged commit 1854694 into elastic:main Sep 30, 2022
@joeypoon joeypoon deleted the chore/rbac-properties branch September 30, 2022 14:47
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Sep 30, 2022
WafaaNasr pushed a commit to WafaaNasr/kibana that referenced this pull request Oct 2, 2022
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.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants