8000 Resolve SSF receiver streams without the acting admin's fine-grained permissions by jungm · Pull Request #55577 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Resolve SSF receiver streams without the acting admin's fine-grained permissions - #55577

Open
jungm wants to merge 1 commit into
keycloak:mainfrom
jungm:ssf-stream-lookup-without-authorization
Open

jungm wants to merge 1 commit into
keycloak:mainfrom
jungm:ssf-stream-lookup-without-authorization

Conversation

@jungm
@jungm jungm commented Nov 26, 2026
Copy link
Copy Markdown

Closes #55576

Summary

The lookup that decides which receivers get an SSF event now runs as the system, not as the admin whose request fired the event.

 SsfTransmitterEventListener.onEvent(adminEvent)
   generateSecurityEventTokensForAdminEvent
     ClientStreamStore.findStreamsForSsfReceiverClients
-      clients().searchClientsByAttributes(ssf.enabled=true)   # FGAP v2 filters out receivers the admin cannot view
+      runWithoutAuthorization
+        clients().searchClientsByAttributes(ssf.enabled=true)
+        .toList()                                             # consumed inside the scope, the query may be lazy

The result never reaches the admin, and whether the admin may perform the action is already checked before the event fires. The by-stream-id lookups behind the SSF admin endpoints are unchanged, as they run after an explicit permission check on the receiver client. The SsfStreamStore javadoc now states this contract. Same pattern as the organization lookups in #51870.

Evidence

SsfTransmitterRestrictedAdminEventTests, in a realm with admin permissions enabled:

restricted-admin has query-users + manage-users only
  GET receiver stream as restricted-admin  -> 403   (cannot view the receiver)
  delete user as restricted-admin          -> RiscAccountPurged SET pushed to receiver
  disable user as restricted-admin         -> RiscAccountDisabled SET pushed to receiver
  • Before: both tests fail on main and against the released 26.8.2 distribution; the server logs No streams found. Discarding admin event <id>.
    After: both pass on main and on 26.8.2 with the patched transmitter jar; the full ssf/tests/base module passes on main.

Merge Danger

Door: two-way

No schema, configuration, or API change; a revert restores the previous lookup.

Blast Radius: SSF delivery

Receivers hidden from a restricted admin now get the events that admin's actions trigger, which is the intended behavior. SSF is experimental.

This change was prepared with the assistance of an AI coding agent.

8000
…permissions

Closes keycloak#55576

Signed-off-by: Markus Jung <jungm@apache.org>
@jungm
jungm marked this pull request as ready for review November 26, 2026 13:10
@jungm
jungm requested a review from a team as a code owner November 26, 2026 13:10
Copilot AI balanced review requested due to automatic review settings November 26, 2026 13:10
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the change making SSF receiver discovery independent of the acting admin’s permissions.

No open issues 🎉

What changed in this PR

Fixes #55576 by making SSF receiver discovery independent of the acting admin’s fine-grained permissions, so eligible receivers are not skipped when a restricted admin triggers an event.

Changes:

  • Runs receiver lookup and stream consumption within runWithoutAuthorization.
  • Documents the system-level lookup contract and callers’ permission-check responsibilities.
  • Adds regression tests for restricted-admin user deletion and disabling, including checks that receiver access remains forbidden.
File Description
ssf/​transmitter/​src/​main/​java/​org/​keycloak/​ssf/​transmitter/​stream/​storage/​SsfStreamStore.java Documents authorization requirements for receiver discovery.
ssf/​transmitter/​src/​main/​java/​org/​keycloak/​ssf/​transmitter/​stream/​storage/​client/​ClientStreamStore.java Bypasses admin authorization filtering while resolving receiver streams.
ssf/​tests/​base/​src/​test/​java/​org/​keycloak/​tests/​ssf/​transmitter/​SsfTransmitterRestrictedAdminEventTests.java Tests event delivery from restricted-admin actions without granting receiver access.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSF events triggered by a restricted admin are discarded when fine-grained admin permissions are enabled

2 participants

0