Enforce MANAGE_APPLICATIONS right on application management routes #131
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.
Summary
Adds enforcement of the
MANAGE_APPLICATIONSinstance-wide right (BitFlag 1) to application management routes. This right was declared insrc/util/util/Rights.tsbut never validated in the route handlers.Routes updated:
PATCH /applications/:application_id- modify applicationPOST /applications/:application_id/delete- delete applicationPOST /applications/:application_id/bot- create bot userPOST /applications/:application_id/bot/reset- reset bot tokenPATCH /applications/:application_id/bot- modify botThis follows the same pattern as PR #130 which enforced CREATE_APPLICATIONS, CREATE_CHANNELS, and CREATE_DMS rights.
Review & Testing Checklist for Human
MANAGE_APPLICATIONSis included in default user rights configuration - if not, this is a breaking change that will prevent users from managing their own applicationssrc/api/util/handlers/route.tsproperly validates therightparameter (same mechanism used in Enforce CREATE_APPLICATIONS, CREATE_CHANNELS, and CREATE_DMS rights #130)Recommended test plan: Create a test user, verify they have MANAGE_APPLICATIONS in their rights, then attempt to modify an application, delete an application, create a bot, reset a bot token, and modify a bot. All operations should succeed. Then test with a user lacking this right to confirm they receive MISSING_RIGHTS errors.
Notes