Skip to content

Security Solution] Fix string spread bug when syncing watchlists to Entity Store #260941

Merged
CAWilson94 merged 2 commits intoelastic:mainfrom
CAWilson94:fix/watchlist-array-spread
Apr 2, 2026
Merged

Security Solution] Fix string spread bug when syncing watchlists to Entity Store #260941
CAWilson94 merged 2 commits intoelastic:mainfrom
CAWilson94:fix/watchlist-array-spread

Conversation

@CAWilson94
Copy link
Copy Markdown
Contributor

Summary:

Fix string spread bug when syncing watchlists to entity store

Fixes a bug where single-string entity.attributes.watchlists values
in the Entity Store were being incorrectly parsed and spread into an
array of individual characters during sync.

If the Entity Store contained a single string value instead of an array
(e.g., "privileged-user-monitoring-watchlist-id"), the sync logic
would destructure it via [...watchlists, watchlistId], resulting in
an array of characters ["p", "r", "i", "v", ...].

This commit adds defensive checks in both WatchlistEntitiesService
(when reading from Elasticsearch) and entity_store_sync (before mutating)
to ensure currentWatchlists is always safely coerced into an array of
strings before any spread operations occur.

…ntity store

Fixes a bug where single-string  values
in the Entity Store were being incorrectly parsed and spread into an
array of individual characters during sync.

If the Entity Store contained a single string value instead of an array
(e.g., ), the sync logic
would destructure it via , resulting in
an array of characters .

This commit adds defensive checks in both
(when reading from Elasticsearch) and  (before mutating)
to ensure  is always safely coerced into an array of
strings before any spread operations occur.
@CAWilson94 CAWilson94 requested a review from a team as a code owner April 2, 2026 14:01
@CAWilson94 CAWilson94 added backport:skip This PR does not require backporting Team:Entity Analytics Security Entity Analytics Team v9.4.0 labels Apr 2, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@CAWilson94 CAWilson94 added the release_note:skip Skip the PR/issue when compiling release notes label Apr 2, 2026
@CAWilson94 CAWilson94 enabled auto-merge (squash) April 2, 2026 14:45
@CAWilson94 CAWilson94 removed request for hop-dev and ymao1 April 2, 2026 14:45
@CAWilson94 CAWilson94 self-assigned this Apr 2, 2026
@CAWilson94 CAWilson94 merged commit 9aa9756 into elastic:main Apr 2, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Entity Analytics Security Entity Analytics Team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants