You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show sub-resource events in Admin events tabs - #55120
The "Admin events" tabs now list the events of an object and of its sub-resources, using filters that can use an index on RESOURCE_PATH (no leading wildcard).
Decisions and assumptions:
The backend stays unchanged and backwards compatible. AdminEvents accepts several resourcePath patterns, sends one request per pattern, and merges the results by time in the UI. Each request asks for first + max entries so that pagination stays correct.
Tabs use the exact path plus /* instead of a trailing *, as names, aliases and federated ids can be prefixes of each other. Where only some sub-resources record events (client roles, group role mappings), the tab lists exactly those.
Client roles use clients/<id>/roles/<name> and roles-by-id/<id>, as changes are recorded under both depending on the endpoint used. Client role tabs list only the composites sub-resource, as role names can contain / and a /* pattern would match other roles. Existing events can't be disambiguated further, and a role named like admin/composites still collides with the composites of admin. The client scope tab also includes the realm default scope paths and the client assignments (clients/*/default-client-scopes/<id>, which can only be narrowed by the clients/ prefix).
The server matches the path with SQL LIKE, so _ and % in names are wildcards as well. For paths containing them, AdminEvents drops false matches client-side and keeps reading pages until the requested page is filled. Patterns can overlap, so merged results are deduplicated by event id and ties in time are ordered by id, as the backend has no tie-breaker. Events with the same timestamp can still repeat or be skipped at a page boundary. This is accepted as a known limitation until the backend accepts several paths in one request (Allow multiple and literal resource paths when querying admin events #55126). * is kept as the wildcard in that check, so a literal * in a name is matched like the server does. A \ in a name can't be found, as the server doesn't escape it (Allow multiple and literal resource paths when querying admin events #55126).
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The event filters omit valid role and client-scope events, can include unrelated role events, and may leave client-role Events tabs empty when opened directly.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Audit-event queries can include another identity provider’s events and duplicate client-role events, producing incorrect audit rows and consuming pagination slots.
Aliases may contain _, but these SQL LIKE queries lack the literal matchPath guard used for client roles. For example, corp_sso/* also returns mapper events from corp-sso; add an exact-or-subpath matcher here so another provider's events are filtered out before pagination.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The changes omit client-scope assignment audit events, misattribute events for slash-containing role names, and can repeat or skip events across pages.
The old *client-scopes/${id} filter also matched client assignments recorded by ClientResource as clients/<clientId>/default-client-scopes/${id} and clients/<clientId>/optional-client-scopes/${id}; neither path matches this new list, so existing CLIENT_SCOPE_CLIENT_MAPPING CREATE/DELETE events disappear from the scope's audit tab. Include both client-assignment patterns to preserve those events without restoring a leading wildcard.
Disambiguate audit queries for slash-containing role names
Client role names may contain /, and RoleContainerResource records CREATE paths using the raw name. With roles admin and admin/read, this pattern therefore includes admin/read's CREATE event in admin's tab; the literal-path guard cannot distinguish it from a descendant either. Narrow the name-based subresource queries to supported role endpoints and disambiguate role identity where paths collide, with a regression case for slash-containing names.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The client-scope filter mishandles the intentional * wildcard, displaying assignments for scope-id when filtering for scope_id instead of treating _ and % literally.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the tests leave merged pagination and false-match filtering unverified, while repeated row assertions can mask missing events.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #55119
The "Admin events" tabs now list the events of an object and of its sub-resources, using filters that can use an index on
RESOURCE_PATH(no leading wildcard).Decisions and assumptions:
AdminEventsaccepts severalresourcePathpatterns, sends one request per pattern, and merges the results by time in the UI. Each request asks forfirst + maxentries so that pagination stays correct./*instead of a trailing*, as names, aliases and federated ids can be prefixes of each other. Where only some sub-resources record events (client roles, group role mappings), the tab lists exactly those.clients/<id>/roles/<name>androles-by-id/<id>, as changes are recorded under both depending on the endpoint used. Client role tabs list only thecompositessub-resource, as role names can contain/and a/*pattern would match other roles. Existing events can't be disambiguated further, and a role named likeadmin/compositesstill collides with the composites ofadmin. The client scope tab also includes the realm default scope paths and the client assignments (clients/*/default-client-scopes/<id>, which can only be narrowed by theclients/prefix).LIKE, so_and%in names are wildcards as well. For paths containing them,AdminEventsdrops false matches client-side and keeps reading pages until the requested page is filled. Patterns can overlap, so merged results are deduplicated by event id and ties in time are ordered by id, as the backend has no tie-breaker. Events with the same timestamp can still repeat or be skipped at a page boundary. This is accepted as a known limitation until the backend accepts several paths in one request (Allow multiple and literal resource paths when querying admin events #55126).*is kept as the wildcard in that check, so a literal*in a name is matched like the server does. A\in a name can't be found, as the server doesn't escape it (Allow multiple and literal resource paths when querying admin events #55126).resource-events.spec.tsuses a new realm for each test and checks the type and operation of the listed events.