Repository navigation
Scope workflow state cleanup on user removal to the user's realm - #55602
Merged
pedroigor merged 2 commits intoNov 27, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Both new persistence regression tests lack @DatabaseTest, so they will not run in the cross-database suite.
1 open issue
What changed in this PR
This PR addresses #55470 by scoping per-resource workflow state operations to a realm, preventing user deletion from removing scheduled steps for resources with matching IDs in other realms.
Changes:
- Adds realm IDs to workflow-state lookup and cleanup APIs and their callers.
- Filters JPA queries through workflow components belonging to the specified realm.
- Adds cross-realm collision regressions and updates existing workflow tests.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/workflow/WorkflowMigrationTest.java |
Updates scheduled-state assertions to include the realm. |
tests/base/src/test/java/org/keycloak/tests/workflow/WorkflowManagementTest.java |
Adds cross-realm cleanup and lookup regression tests. |
tests/base/src/test/java/org/keycloak/tests/workflow/step/DeleteUserStepTest.java |
Uses realm-scoped lookups in user-deletion assertions. |
tests/base/src/test/java/org/keycloak/tests/workflow/execution/WorkflowConcurrencyTest.java |
Uses realm-scoped lookups in concurrency assertions. |
server-spi-private/src/main/java/org/keycloak/models/workflow/WorkflowStateProvider.java |
Adds and documents realm parameters for resource operations. |
model/jpa/src/main/java/org/keycloak/models/workflow/JpaWorkflowStateProviderFactory.java |
Passes the deleted user’s realm to cleanup. |
model/jpa/src/main/java/org/keycloak/models/workflow/JpaWorkflowStateProvider.java |
Restricts resource lookups and deletions by workflow realm. |
model/jpa/src/main/java/org/keycloak/models/workflow/DefaultWorkflowProvider.java |
Supplies the realm when retrieving scheduled state. |
Review effort: Balanced
Closes keycloak#55470 - scope the delete to workflows owned by the user's realm, following the same approach used for removeAll() Signed-off-by: Stefan Guilhen <[email protected]>
- same realm-isolation gap as the removeByResource fix, on the read side (getScheduledStepsByResource()) Signed-off-by: Stefan Guilhen <[email protected]>
sguilhen
force-pushed
the
55470-workflow-cross-realm-state
branch
from
November 27, 2026 02:39
4337407 to
5e221cc
Compare
pedroigor
approved these changes
Nov 27, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #55470