Skip to content

fix(ui): sudo confirmation before team delete#289

Closed
kkopanidis wants to merge 2 commits into
ui-rewritefrom
fix/team-delete-sudo-ui
Closed

fix(ui): sudo confirmation before team delete#289
kkopanidis wants to merge 2 commits into
ui-rewritefrom
fix/team-delete-sudo-ui

Conversation

@kkopanidis

Copy link
Copy Markdown
Contributor

Problem

Team delete in the admin UI called DELETE /authentication/teams/:teamId without checking whether the admin session had sudo. After the API change, deletes would fail for sessions missing the sudo claim unless the UI re-authenticates first.

Solution

  • Add hasSudoAccess, sudoReauthenticate, and completeSudoTwoFactor server actions
  • Add SudoDialog + useSudoAction hook to collect password (and 2FA when required) before sensitive operations
  • Wrap team delete in runWithSudo so re-auth runs only when the JWT lacks sudo
  • Harden 2FA token handling to accept both token and legacy result response shapes

Test plan

  • Delete a team immediately after login — should delete without extra password prompt
  • Delete a team with an old session token (no sudo claim) — password dialog appears, then delete succeeds
  • Admin with 2FA enabled — password step then authenticator code, then delete succeeds
  • Cancel sudo dialog — team is not deleted

Prompt for admin re-authentication when the session JWT lacks sudo before
calling DELETE /authentication/teams/:teamId, matching the new API guard.
Sudo applies to Client API end-user actions, not Admin API routes.
Conduit-UI team delete uses the admin API and does not need re-auth.
@kkopanidis

Copy link
Copy Markdown
Contributor Author

Closing: sudo is for Client API end-user actions (user bearer token), not Admin API. Team delete in Conduit-UI uses DELETE /authentication/teams/:id on the admin API and should not prompt for sudo. Reverted SudoDialog/useSudoAction in acaac2b.

@kkopanidis kkopanidis closed this Jun 22, 2026
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.

1 participant