Skip to content

[9.5] fix(servicenow): add compact role-based DLS to reduce ACL memory (#4392) - #4461

Merged
Jan-Kazlouski-elastic merged 1 commit into
9.5from
backport/9.5/pr-4392
Sep 8, 2026
Merged

Jan-Kazlouski-elastic merged 1 commit into
9.5from
backport/9.5/pr-4392

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Backports the following commits to 9.5:

## Closes elastic/chat-program#49

Part of elastic/chat-program#47.
ServiceNow DLS expands every table read role into individual `user_id:`
/ `user:` / `email:` entries on each content document (and attachment).
For large tenants — especially when a table ACL includes the `public`
role — that can mean hundreds of thousands of ACL entries per document
and OOM Elasticsearch during `_reindex`.

This PR adds compact DLS, **opt-in** via `expand_role_members=false`
(default `true` preserves existing behavior). When compact mode is
enabled:

- Content documents store compact `role_id:<sys_id>` tokens instead of
every role member
- Identity docs include role memberships from `sys_user_has_role` so DLS
term overlap still works
- Tables with a `public` read role omit `_allow_access_control`
(world-readable via existing DLS `must_not exists`)
- Tables where read roles cannot be resolved omit
`_allow_access_control` (same as public tables; world-readable via
existing DLS `must_not exists`)

Also fixes advanced sync rules to resolve ACL per table instead of
stamping an empty ACL on every batch.

Changing the setting requires a full content sync and access control
sync.

## Checklists

#### Pre-Review Checklist
- [x] this PR does NOT contain credentials of any kind, such as API keys
or username/passwords (double check `config.yml.example`)
- [x] this PR has a meaningful title
- [x] this PR links to all relevant github issues that it fixes or
partially addresses
- [x] if there is no GH issue, please create it. Each PR should have a
link to an issue
- [x] this PR has a thorough description
- [x] Covered the changes with automated tests
- [x] Tested the changes locally
- [ ] Added a label for each target release version (example: `v7.13.2`,
`v7.14.0`, `v8.0.0`)
- [ ] For bugfixes: backport safely to all minor branches still
receiving patch releases
- [ ] Considered corresponding documentation changes
- [ ] Contributed any configuration settings changes to the
configuration reference
- [ ] if you added or changed Rich Configurable Fields for a Native
Connector, you made a corresponding PR in
[Kibana](https://github.com/elastic/kibana/blob/main/packages/kbn-search-connectors/types/native_connectors.ts)

#### Changes Requiring Extra Attention

- [x] Security-related changes (encryption, TLS, SSRF, etc)
- [ ] New external service dependencies added.

## Related Pull Requests

* #4396 — SharePoint Online
compact site-group DLS (same tracking issue)
* Kibana `native_connectors.ts` RCF for `expand_role_members` — to be
opened separately

## Release Note

ServiceNow document-level security can store compact role tokens on
content documents instead of expanding every role member onto each
record, reducing memory use for large tenants. Disable **Expand role
members** to enable compact mode. The default preserves the previous
per-user expansion behavior. Changing the setting requires a full
content sync and access control sync.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic merged commit d602e7a into 9.5 Sep 8, 2026
2 checks passed
@Jan-Kazlouski-elastic
Jan-Kazlouski-elastic deleted the backport/9.5/pr-4392 branch September 8, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants