Security: Replace inline superuser check with permission-based access control in bulk email endpoint
- Dominant language
- Python
- Stars
- 2k
- Forks
- 984
- Avg merge
- 2h 54m
- Merged PRs (30d)
- 14
Description
The **notify_users_about_challenge** endpoint currently relies on inline **request.user.is_superuser** checks for authorization.
This approach is fragile and risks accidental misuse if the view is reused or middleware behavior changes.
Proposed solution:
Use DRF permission classes (e.g. IsAdminUser or a custom permission)
Add endpoint-specific throttling
Add audit logging for bulk email triggers
If this approach is acceptable, I’d be happy to open a PR.
Contributor guide
Research direction
Start at the notify_users_about_challenge endpoint and inspect its current request.user.is_superuser authorization. Review the applicable DRF permission, throttling, and audit-logging patterns, then verify that authorization is permission-based, bulk triggers are throttled, and triggering is audited.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- authorization, backend-api-design, security
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100