[PM-32594] Add authorization to admin-initiated sponsorship endpoints#7095
Conversation
|
Claude finished @cturnbull-bitwarden's task in 2m 20s —— View job Pull Request Review: PM-32594 Add authorization to admin-initiated sponsorship endpointsSummaryThis PR fixes a security vulnerability (VULN-441) where the Changes Reviewed
AnalysisSecurity fix is correct. The Route parameter renaming is necessary. The rename from Both deployment targets are covered. The cloud controller ( Test coverage is thorough. The 13 new integration tests cover both endpoints across all relevant authorization scenarios: non-member (forbidden), regular member without ManageUsers (forbidden), owner (allowed), admin (allowed), custom user with ManageUsers (allowed), and cross-organization attack (forbidden). VerdictNo issues found. This is a focused, well-implemented security fix with excellent test coverage. Reviewed by Claude (Anthropic) | Model: Opus 4.6 |
|
|
kdenney
left a comment
There was a problem hiding this comment.
Looks good; just one question to confirm first.
src/Api/Controllers/SelfHosted/SelfHostedOrganizationSponsorshipsController.cs
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7095 +/- ##
==========================================
- Coverage 60.74% 56.75% -3.99%
==========================================
Files 2026 2026
Lines 88681 88681
Branches 7905 7905
==========================================
- Hits 53872 50334 -3538
- Misses 32902 36518 +3616
+ Partials 1907 1829 -78 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|





🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-32594
📔 Objective
Adds authorization checks to the
AdminInitiatedRevokeSponsorshipAsyncandResendSponsorshipOfferendpoints in both the cloud and self-hosted sponsorship controllers. Previously, these endpoints only required[Authorize("Application")], meaning any authenticated user could call them regardless of their relationship to thesponsoring organization.
Now uses
[Authorize<ManageUsersRequirement>]to enforce that the caller is an Owner, Admin, or has the ManageUsers permission in the sponsoring organization — consistent with the existingGetSponsoredOrganizationsendpoint andCreateSponsorshipCommandvalidation.Route parameters on the affected endpoints were renamed from
{sponsoringOrgId}to{organizationId}to work with the existing authorization handler infrastructure. The C# parameter names remain unchanged.