Skip to content

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

Open
ebariaux wants to merge 13 commits into
mainfrom
bugfix/rules-users-facade-scoping
Open

ebariaux wants to merge 13 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.

@ebariaux ebariaux added the Bug Error or issue in the system label Oct 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant