Skip to content

Commit 19ad73b

Browse files
committed
align permission tests
1 parent 58ae774 commit 19ad73b

1 file changed

Lines changed: 34 additions & 11 deletions

File tree

  • x-pack/solutions/security/test/security_solution_api_integration/test_suites/edr_workflows/artifacts/trial_license_complete_tier

x-pack/solutions/security/test/security_solution_api_integration/test_suites/edr_workflows/artifacts/trial_license_complete_tier/endpoint_list_api_rbac.ts

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,37 @@ export default function ({ getService }: FtrProviderContext) {
9393
method: 'post',
9494
info: 'create single item',
9595
path: ENDPOINT_LIST_ITEM_URL,
96-
getBody: () =>
97-
exceptionsGenerator.generateEndpointExceptionForCreate({
96+
getBody: () => {
97+
const item = exceptionsGenerator.generateEndpointExceptionForCreate({
9898
tags: endpointExceptionData?.artifact.tags || [
9999
buildPerPolicyTag(fleetEndpointPolicy.packagePolicy.id),
100100
],
101-
}),
101+
});
102+
return {
103+
...item,
104+
item_id: item.item_id ?? `test-item-${Date.now()}`,
105+
os_types: item.os_types ?? ['windows'],
106+
tags: item.tags ?? [],
107+
};
108+
},
102109
},
103110
{
104111
method: 'put',
105112
info: 'update single item',
106113
path: ENDPOINT_LIST_ITEM_URL,
107-
getBody: () =>
108-
exceptionsGenerator.generateEndpointExceptionForUpdate({
114+
getBody: () => {
115+
const item = exceptionsGenerator.generateEndpointExceptionForCreate({
116+
tags: endpointExceptionData.artifact.tags,
117+
});
118+
return {
119+
...item,
109120
id: endpointExceptionData.artifact.id,
110121
item_id: endpointExceptionData.artifact.item_id,
111-
tags: endpointExceptionData.artifact.tags,
112122
_version: endpointExceptionData.artifact._version,
113-
}),
123+
os_types: item.os_types ?? ['windows'],
124+
tags: item.tags ?? [],
125+
};
126+
},
114127
},
115128
];
116129

@@ -244,7 +257,11 @@ export default function ({ getService }: FtrProviderContext) {
244257
}
245258
});
246259

247-
describe('@skipInServerless and user has endpoint exception access but no global artifact access', () => {
260+
// NOTE: This test is skipped in 9.1 because the privilege model is different.
261+
// In 9.1, endpoint_exceptions_all doesn't grant lists-all privilege, so POST/PUT
262+
// fail at the route level (403 for missing lists-all) before reaching the extension
263+
// point validation that would return EndpointArtifactError.
264+
describe.skip('@skipInServerless and user has endpoint exception access but no global artifact access', () => {
248265
let noGlobalArtifactSupertest: TestAgent;
249266

250267
before(async () => {
@@ -275,7 +292,7 @@ export default function ({ getService }: FtrProviderContext) {
275292
const requestBody = endpointListApiCall.getBody();
276293
// keep space tag, but replace any per-policy tags with a global tag
277294
requestBody.tags = [
278-
...requestBody.tags.filter((tag) => !isPolicySelectionTag(tag)),
295+
...(requestBody.tags ?? []).filter((tag) => !isPolicySelectionTag(tag)),
279296
GLOBAL_ARTIFACT_TAG,
280297
];
281298

@@ -295,7 +312,7 @@ export default function ({ getService }: FtrProviderContext) {
295312
const requestBody = endpointListApiCall.getBody();
296313

297314
// remove existing tag
298-
requestBody.tags = requestBody.tags.filter((tag) => !isPolicySelectionTag(tag));
315+
requestBody.tags = (requestBody.tags ?? []).filter((tag) => !isPolicySelectionTag(tag));
299316

300317
await noGlobalArtifactSupertest[endpointListApiCall.method](endpointListApiCall.path)
301318
.set('kbn-xsrf', 'true')
@@ -349,7 +366,13 @@ export default function ({ getService }: FtrProviderContext) {
349366
for (const endpointListApiCall of [
350367
...endpointListCalls,
351368
...needsWritePrivilege,
352-
...needsReadPrivilege,
369+
// NOTE: needsReadPrivilege tests are excluded in 9.1 because the privilege model is different.
370+
// In 9.1, siemV3: ['all'] grants ALL privileges including endpoint exceptions.
371+
// In 9.3+, endpoint exceptions were moved to a separate sub-feature, so
372+
// siemV3: ['all'] no longer includes them and requires explicit
373+
// endpoint_exceptions_read/endpoint_exceptions_all privileges.
374+
// The t1_analyst role with siemV3: ['all'] has full endpoint exceptions access in 9.1.
375+
// ...needsReadPrivilege,
353376
]) {
354377
it(`should error on [${endpointListApiCall.method}] - [${endpointListApiCall.info}]`, async () => {
355378
await t1AnalystSupertest[endpointListApiCall.method](endpointListApiCall.path)

0 commit comments

Comments
 (0)