Skip to content

Fix user query scoping and filtering in rules facades - #3475

Merged
wborn merged 15 commits into
mainfrom
bugfix/rules-users-facade-scoping
Oct 29, 2026
Merged

wborn merged 15 commits into
mainfrom
bugfix/rules-users-facade-scoping

Conversation

@ebariaux

@ebariaux ebariaux commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR ensures rules retrieve users within their engine scope while preserving caller-supplied filters and keeping reusable queries isolated between executions.

  • Enforce the engine’s realm for asset-scoped user queries, alongside the existing asset-subtree restriction.
  • Preserve caller attribute filters when excluding system accounts.
  • Combine service-account filtering with username predicates using AND, preventing username filters from bypassing account restrictions or returning unrelated users.
  • Copy queries and nested predicates before execution, preventing accumulated restrictions and scope leakage between executions.
  • Preserve empty asset selections so they return no users.

Compatibility and release notes

There are no API signature changes, but query results can change for rules or applications relying on the previous incorrect filtering. It's worth adding the below paragraph in the release notes.

User queries now enforce account-type and username filters together. Rules also preserve caller-supplied attribute filters, and asset-scoped rules only retrieve users from their own realm who are linked within the scoped asset subtree. Existing rules and notification recipient selections may consequently return fewer users. Review configurations that relied on previously ignored filters or cross-realm user links.

Part of the rules facade scoping review tracked in #2675.

@ebariaux ebariaux added the Bug Error or issue in the system label Oct 23, 2026
@ebariaux
ebariaux requested a review from a team October 26, 2026 09:55
@sonarqubecloud

Copy link
Copy Markdown

@wborn wborn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! 👍

@wborn
wborn added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 74894fd Oct 29, 2026
24 checks passed
@wborn
wborn deleted the bugfix/rules-users-facade-scoping branch October 29, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error or issue in the system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants