Skip to content

Commit 847be91

Browse files
authored
[Security Solution][Detection Engine] adds bulkGetUserProfiles privilege to Security Feature (elastic#211824)
## Summary - addresses elastic#202051 Few observations, based on ticket [description](elastic#202051): 1. User can update assignees in alert(i.e. update any alert details, which is handled by **SecuritySolution** priv) 2. User can see suggested users in searchbox 3. User **can not** see assignees details(name, avatar) in alerts table column and alerts flyout(that's where error toast originates from) Why this happens? 2 different APIs used to show users in searchbox and user details in alerts table column: 1. API to show users in searchbox: [/internal/detection_engine/users/_find](https://github.com/elastic/kibana/blob/8.18/x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/routes/users/suggest_user_profiles_route.ts#L24) It requires `securitySolution` privilege 2. API for alerts table cell: [/internal/security/user_profile/_bulk_get](https://github.com/elastic/kibana/blob/8.18/x-pack/platform/plugins/shared/security/server/routes/user_profile/bulk_get.ts#L20) It requires `bulkGetUserProfiles` privilege User was configured with read only Security Feature, that covers only first API, that's why we see error > API [POST /internal/security/user_profile/_bulk_get] is unauthorized for user, this action is granted by the Kibana privileges [bulkGetUserProfiles] (403) However `bulkGetUserProfiles` is covered by `Cases` feature already. If Cases access will be set to read, user would be able to see assignees details through `/internal/security/user_profile/_bulk_get` API. It happens, because cases API tags include `bulkGetUserProfiles` privilege: https://github.com/elastic/kibana/blob/8.18/x-pack/platform/plugins/shared/cases/common/utils/api_tags.ts#L32, https://github.com/elastic/kibana/blob/8.18/x-pack/solutions/security/packages/features/src/cases/types.ts#L7 This PR includes `bulkGetUserProfiles` privilege in Security Feature: elastic#211824. Since, it's already present in Cases feature, and user profiles available through Security Solution `/internal/detection_engine/users/_find` API
1 parent 601e4de commit 847be91

File tree

6 files changed

+51
-7
lines changed

6 files changed

+51
-7
lines changed

x-pack/solutions/security/packages/features/src/security/v1_features/kibana_features.ts

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const getSecurityBaseKibanaFeature = ({
118118
'timeline_read',
119119
'notes_write',
120120
'notes_read',
121+
'bulkGetUserProfiles',
121122
],
122123
savedObject: {
123124
all: ['alert', ...savedObjects],
@@ -159,6 +160,7 @@ export const getSecurityBaseKibanaFeature = ({
159160
'cloud-defend-read',
160161
'timeline_read',
161162
'notes_read',
163+
'bulkGetUserProfiles',
162164
],
163165
savedObject: {
164166
all: [],

x-pack/solutions/security/packages/features/src/security/v2_features/kibana_features.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const getSecurityV2BaseKibanaFeature = ({
8787
'cloud-security-posture-read',
8888
'cloud-defend-all',
8989
'cloud-defend-read',
90+
'bulkGetUserProfiles',
9091
],
9192
savedObject: {
9293
all: ['alert', ...savedObjects],
@@ -104,7 +105,14 @@ export const getSecurityV2BaseKibanaFeature = ({
104105
read: {
105106
app: [APP_ID, CLOUD_POSTURE_APP_ID, CLOUD_DEFEND_APP_ID, 'kibana'],
106107
catalogue: [APP_ID],
107-
api: [APP_ID, 'lists-read', 'rac', 'cloud-security-posture-read', 'cloud-defend-read'],
108+
api: [
109+
APP_ID,
110+
'lists-read',
111+
'rac',
112+
'cloud-security-posture-read',
113+
'cloud-defend-read',
114+
'bulkGetUserProfiles',
115+
],
108116
savedObject: {
109117
all: [],
110118
read: [...savedObjects],

x-pack/test/api_integration/apis/cases/bulk_get_user_profiles.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import {
2121
casesReadUser,
2222
obsCasesAllUser,
2323
obsCasesReadUser,
24-
secAllCasesNoneUser,
2524
secAllUser,
2625
secReadCasesReadUser,
26+
secAllCasesNoneUser,
27+
secNoneUser,
2728
} from './common/users';
2829

2930
export default ({ getService }: FtrProviderContext): void => {
@@ -67,6 +68,7 @@ export default ({ getService }: FtrProviderContext): void => {
6768
{ user: secReadCasesReadUser },
6869
{ user: casesReadUser },
6970
{ user: obsCasesReadUser },
71+
{ user: secAllCasesNoneUser },
7072
]) {
7173
it(`User ${
7274
user.username
@@ -82,7 +84,7 @@ export default ({ getService }: FtrProviderContext): void => {
8284
});
8385
}
8486

85-
for (const { user } of [{ user: secAllCasesNoneUser }]) {
87+
for (const { user } of [{ user: secNoneUser }]) {
8688
it(`User ${
8789
user.username
8890
} with roles(s) ${user.roles.join()} cannot bulk get user profiles because they lack the bulkGetUserProfiles privilege`, async () => {

x-pack/test/api_integration/apis/cases/common/roles.ts

+24
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,30 @@ export const secReadCasesNone: Role = {
384384
},
385385
};
386386

387+
export const secNone: Role = {
388+
name: 'sec_none_role_api_int',
389+
privileges: {
390+
elasticsearch: {
391+
indices: [
392+
{
393+
names: ['*'],
394+
privileges: ['all'],
395+
},
396+
],
397+
},
398+
kibana: [
399+
{
400+
feature: {
401+
siem: [],
402+
actions: ['all'],
403+
actionsSimulators: ['all'],
404+
},
405+
spaces: ['*'],
406+
},
407+
],
408+
},
409+
};
410+
387411
/**
388412
* Roles for Cases in the stack
389413
*/

x-pack/test/api_integration/apis/cases/common/users.ts

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
secReadCasesAll,
3737
secReadCasesNone,
3838
secReadCasesRead,
39+
secNone,
3940
casesV2NoReopenWithCreateComment,
4041
obsCasesV2NoReopenWithCreateComment,
4142
secCasesV2NoReopenWithCreateComment,
@@ -132,6 +133,12 @@ export const secReadUser: User = {
132133
roles: [secRead.name],
133134
};
134135

136+
export const secNoneUser: User = {
137+
username: 'sec_none_user_api_int',
138+
password: 'password',
139+
roles: [secNone.name],
140+
};
141+
135142
export const secReadCasesNoneUser: User = {
136143
username: 'sec_read_cases_none_user_api_int',
137144
password: 'password',
@@ -297,6 +304,7 @@ export const users = [
297304
secReadCasesAllUser,
298305
secReadCasesReadUser,
299306
secReadUser,
307+
secNoneUser,
300308
secReadCasesNoneUser,
301309
casesOnlyDeleteUser,
302310
casesOnlyReadDeleteUser,

x-pack/test_serverless/api_integration/test_suites/security/platform_security/authorization.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export default function ({ getService }: FtrProviderContext) {
229229
"api:cloud-security-posture-read",
230230
"api:cloud-defend-all",
231231
"api:cloud-defend-read",
232+
"api:bulkGetUserProfiles",
232233
"api:securitySolution-entity-analytics",
233234
"api:securitySolution-threat-intelligence",
234235
"api:securitySolution-showEndpointExceptions",
@@ -839,7 +840,6 @@ export default function ({ getService }: FtrProviderContext) {
839840
"ui:discover_v2/createShortUrl",
840841
"ui:discover_v2/storeSearchSession",
841842
"ui:discover_v2/generateCsv",
842-
"api:bulkGetUserProfiles",
843843
"api:dashboardUsageStats",
844844
"api:downloadCsv",
845845
"app:dashboards",
@@ -1071,6 +1071,7 @@ export default function ({ getService }: FtrProviderContext) {
10711071
"api:cloud-security-posture-read",
10721072
"api:cloud-defend-all",
10731073
"api:cloud-defend-read",
1074+
"api:bulkGetUserProfiles",
10741075
"api:securitySolution-entity-analytics",
10751076
"api:securitySolution-threat-intelligence",
10761077
"app:securitySolution",
@@ -1677,7 +1678,6 @@ export default function ({ getService }: FtrProviderContext) {
16771678
"ui:discover_v2/createShortUrl",
16781679
"ui:discover_v2/storeSearchSession",
16791680
"ui:discover_v2/generateCsv",
1680-
"api:bulkGetUserProfiles",
16811681
"api:dashboardUsageStats",
16821682
"api:downloadCsv",
16831683
"app:dashboards",
@@ -1771,6 +1771,7 @@ export default function ({ getService }: FtrProviderContext) {
17711771
"api:rac",
17721772
"api:cloud-security-posture-read",
17731773
"api:cloud-defend-read",
1774+
"api:bulkGetUserProfiles",
17741775
"api:securitySolution-entity-analytics",
17751776
"api:securitySolution-threat-intelligence",
17761777
"app:securitySolution",
@@ -2045,7 +2046,6 @@ export default function ({ getService }: FtrProviderContext) {
20452046
"saved_object:search/close_point_in_time",
20462047
"ui:discover_v2/show",
20472048
"ui:discover_v2/createShortUrl",
2048-
"api:bulkGetUserProfiles",
20492049
"api:dashboardUsageStats",
20502050
"app:dashboards",
20512051
"ui:catalogue/dashboard",
@@ -2135,6 +2135,7 @@ export default function ({ getService }: FtrProviderContext) {
21352135
"api:rac",
21362136
"api:cloud-security-posture-read",
21372137
"api:cloud-defend-read",
2138+
"api:bulkGetUserProfiles",
21382139
"api:securitySolution-entity-analytics",
21392140
"api:securitySolution-threat-intelligence",
21402141
"api:securitySolution-showEndpointExceptions",
@@ -2411,7 +2412,6 @@ export default function ({ getService }: FtrProviderContext) {
24112412
"saved_object:search/close_point_in_time",
24122413
"ui:discover_v2/show",
24132414
"ui:discover_v2/createShortUrl",
2414-
"api:bulkGetUserProfiles",
24152415
"api:dashboardUsageStats",
24162416
"app:dashboards",
24172417
"ui:catalogue/dashboard",

0 commit comments

Comments
 (0)