Repository navigation
fix: handle team deletion for dex user - #1126
CasLubbers wants to merge 4 commits into
Conversation
Signed-off-by: Cas Lubbers <clubbers@akamai.com>
Coverage report
Show files with reduced coverage 🔻
Test suite run success905 tests passing in 31 suites. Report generated by 🧪jest coverage report action from 1a9b95b |
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain because deleting admin strips team-administrator roles, while snapshot-based group updates can overwrite concurrent role changes or restore deleted team memberships.
2 open issues
What changed in this PR
This PR updates team deletion to remove the deleted team’s membership group from Dex users before deleting team resources.
Changes:
- Adds Dex-only membership cleanup before team deletion.
- Aborts deletion if a Dex update fails.
- Adds tests for membership cleanup, failure handling, and unchanged Keycloak behavior.
| File | Description |
|---|---|
src/otomi-stack.ts |
Removes team groups from Dex users before deleting team resources. |
src/otomi-stack.test.ts |
Tests Dex cleanup, deletion aborts, and Keycloak isolation. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Unsynchronized group-list updates can restore deleted memberships or overwrite concurrent edits, while deleting the reserved admin team strips the global team-admin role from every Dex team admin.
2 open issues
Review effort: Balanced
…user groups Signed-off-by: Cas Lubbers <clubbers@akamai.com>
| if (env.AUTH_PROVIDER === 'dex') await this.removeTeamFromDexUsers(id) | ||
| const filePaths = await this.deleteTeamObjects(id) | ||
| await this.doDeleteDeployment(filePaths) |
There was a problem hiding this comment.
users are not stored in the filestore
Signed-off-by: Cas Lubbers <clubbers@akamai.com>


When a team was deleted, Dex users kept the
team-<id>group. That breaks user edits (Team(s) not found) and gives old members access again if a team with the same name is recreated.deleteAplTeamnow strips the group from all Dex users before deleting the team.Why the lock
Dex can't add or remove a single group.
UpdatePasswordalways replaces the whole list. So every change is read, modify, write, and two at the same time can overwrite each other. For example, deletingblueandredat the same time could bringblueback.withDexGroupLockis a small promise queue: each group change waits for the previous one to finish, then reads fresh data. It covers team delete,editUserandeditTeamUsers. It's in-process only, which is fine since apl-api runs a single replica.How to test
blueandred, deleteblue, then check that the user only hasteam-redand can still be edited.