-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] split endpoint rbac feature flags #143991
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,18 @@ function hasPermission( | |
hasEndpointManagementAccess: boolean, | ||
privilege: typeof ENDPOINT_PRIVILEGES[number] | ||
): boolean { | ||
return isEndpointRbacEnabled | ||
? fleetAuthz.packagePrivileges?.endpoint?.actions[privilege].executePackageAction ?? false | ||
: hasEndpointManagementAccess; | ||
// user is superuser, always return true | ||
if (hasEndpointManagementAccess) { | ||
return true; | ||
} | ||
|
||
// not superuser and FF not enabled, no access | ||
if (!isEndpointRbacEnabled) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I wrote below, I think we should check here the specific FF depending on the feature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return false; | ||
} | ||
|
||
// FF enabled, access based on privileges | ||
return fleetAuthz.packagePrivileges?.endpoint?.actions[privilege].executePackageAction ?? false; | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ export const useEndpointPrivileges = (): Immutable<EndpointPrivileges> => { | |
|
||
const fleetServices = fleetServicesFromUseKibana ?? fleetServicesFromPluginStart; | ||
const isEndpointRbacEnabled = useIsExperimentalFeatureEnabled('endpointRbacEnabled'); | ||
const isEndpointRbacV1Enabled = useIsExperimentalFeatureEnabled('endpointRbacV1Enabled'); | ||
|
||
const endpointPermissions = calculatePermissionsFromCapabilities( | ||
useKibana().services.application.capabilities | ||
|
@@ -57,7 +58,7 @@ export const useEndpointPrivileges = (): Immutable<EndpointPrivileges> => { | |
licenseService, | ||
fleetAuthz, | ||
userRoles, | ||
isEndpointRbacEnabled, | ||
isEndpointRbacEnabled || isEndpointRbacV1Enabled, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add another param here instead of using an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a use case for this? I purposely didn't want to over engineer it since we have pretty known use cases. since we added FF for the sake of privileges, it feels a bit odd to account for using the FF without privileges. this approach (in conjunction with the changes in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think from the change here it will be evaluated if one of both is enabled. So for a user having There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spoke offline, the control is handled by the change made in |
||
endpointPermissions | ||
) | ||
: getEndpointAuthzInitialState()), | ||
|
@@ -72,6 +73,7 @@ export const useEndpointPrivileges = (): Immutable<EndpointPrivileges> => { | |
licenseService, | ||
userRoles, | ||
isEndpointRbacEnabled, | ||
isEndpointRbacV1Enabled, | ||
endpointPermissions, | ||
]); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the outer describe has
superuser
so we're ensuring this test block doesn't.