openedx / openedx/edx-drf-extensions

JwtRedirectToLoginIfUnauthenticatedMiddleware does not support "composed" DRF permissions

Open
#533 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.