Skip to content

[PM-40493] Claimed Domain Account Delete Check - #8263

Open
rr-bw wants to merge 2 commits into
mainfrom
auth/pm-40493/claimed-domain-account-delete-check
Open

[PM-40493] Claimed Domain Account Delete Check#8263
rr-bw wants to merge 2 commits into
mainfrom
auth/pm-40493/claimed-domain-account-delete-check

Conversation

@rr-bw

@rr-bw rr-bw commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

PM-40493

📔 Objective

Adds a claimed-domain check to DeleteAsync({single param}), so that both endpoints are covered by the one check:

  • DELETE /accounts - Delete() (was already covered)
  • POST /accounts/delete-recover-token - PostDeleteRecoverToken()

📸 Screenshots

@rr-bw
rr-bw marked this pull request as ready for review August 26, 2026 19:53
@rr-bw
rr-bw requested a review from a team as a code owner August 26, 2026 19:53
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR moves the claimed-domain guard from AccountsController.Delete into UserService.DeleteAsync(User), so both the authenticated DELETE /accounts path and the anonymous POST /accounts/delete-recover-token path are covered by a single check. I traced every caller of IUserService.DeleteAsync / UserManager<User>.DeleteAsync across src, util, and bitwarden_license — the only two are the controller actions named in the description, and the org-admin path (DeleteClaimedOrganizationUserAccountCommand) deletes through IUserRepository.DeleteManyAsync, so it is unaffected. In the token overload the guard runs after VerifyUserTokenAsync, which keeps the claimed/unclaimed state from being observable without a valid delete token. The error surface for DELETE /accounts is unchanged, since the controller previously threw the same BadRequestException(new CannotDeleteClaimedAccountError().Message).

Code Review Details

No findings.

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