Skip to content

Conversation

@szwarckonrad
Copy link
Contributor

Backport

This will backport the following commits from main to 9.1:

Questions ?

Please refer to the Backport tool documentation

…elastic#246019)

This PR fixes the deprecated `api/endpoint_list` APIs to properly
enforce RBAC, space awareness, and security tag assignment through the
extension point system.

Changes:
- Modified 5 ExceptionListClient methods to invoke extension points:
`createEndpointListItem`, `updateEndpointListItem`,
`deleteEndpointListItem`, `getEndpointListItem`, `findEndpointListItem`
- Added entry validation and disallowed field checks to create route
- Fixed return type in read route to match API schema
- Added comprehensive unit tests for all 5 methods
- Added API integration tests covering all RBAC scenarios

All changes mirror the existing exception list API behavior.

Closes elastic/security-team#14818

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 70c5025)

# Conflicts:
#	x-pack/solutions/security/test/security_solution_api_integration/test_suites/edr_workflows/artifacts/trial_license_complete_tier/endpoint_exceptions.ff_enabled.ts
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

Copy link
Contributor

@gergoabraham gergoabraham 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, only minor questions 🚀

Copy link
Contributor

Choose a reason for hiding this comment

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

did you maybe intend to add this empty file or just a merge issue?

Comment on lines +104 to +106
item_id: item.item_id ?? `test-item-${Date.now()}`,
os_types: item.os_types ?? ['windows'],
tags: item.tags ?? [],
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change needed? i see that generateEndpointExceptionForCreate() was added in 9.3, so you needed to update the getBody() on update single item path below using an already existing helper function, but here, in create single item, shouldn't getBody() be the same as for 9.2/9.3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change is needed because the return type of generateEndpointExceptionForCreate() differs between 9.1 and 9.3/main:
In main/9.3: generateEndpointExceptionForCreate() returns CreateExceptionListItemSchemaWithNonNullProps, which guarantees that item_id, os_types, and tags are non-null. So the test can directly return the result.

In 9.1: generateEndpointExceptionForCreate() returns CreateExceptionListItemSchema, where these fields are optional/potentially undefined.

Since the test requires these fields to have values (e.g., for cleanup via item_id), I added fallback values:
item_id: item.item_id ?? test-item-${Date.now()},os_types: item.os_types ?? ['windows'],tags: item.tags ?? [],
This ensures the test works correctly with 9.1's generator behavior. The same pattern was needed for "update single item" for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

i see your point. what actually puzzles me is that the return type was changed in 9.3, so i guess 9.1 and 9.2 could be the same, but you took different approaches in the 2 backport PR. anyway, as it's already merged, and it works, i'm good with it 👍

@szwarckonrad szwarckonrad merged commit d5fd415 into elastic:9.1 Jan 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants