openedx / openedx/edx-drf-extensions
JwtRedirectToLoginIfUnauthenticatedMiddleware does not support "composed" DRF permissions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18
- Forks
- 24
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 5
Description
JwtRedirectToLoginIfUnauthenticatedMiddleware crashes when attempting to introspect a VIewSet to determine if it contains a specific permission class. This middleware was authored before DRF permission composition existed, so it assumes the permission_classes property always points to an iterable of classes. That is no longer a safe assumption.
Here's a proposed fix that has been tested locally, but it still needs unit tests written: https://github.com/openedx/edx-drf-extensions/pull/528
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing JwtRedirectToLoginIfUnauthenticatedMiddleware and the proposed fix in pull request 528. Add unit tests covering Django REST Framework composed permissions and the existing permission-class behavior; done means the middleware no longer crashes and the tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100