Public bug reported:

django-oauth-toolkit 3.4.1+dfsg-1 is blocked in proposed-migration: its 
autopkgtest fails on every
architecture (amd64, amd64v3, arm64, armhf, ppc64el, s390x) when 
python-oauthlib is upgraded to
3.3.1-2ubuntu1, with 10 failures all in tests/test_device.py::TestDeviceFlow* /
TestDeviceFlowWithSwappedDeviceGrantModel, e.g.:

  FAILED 
tests/test_device.py::TestDeviceFlow::test_device_flow_authorization_user_code_confirm_and_access_token_default_scopes
  FAILED 
tests/test_device.py::TestDeviceFlow::test_device_flow_scope_longer_than_64_chars_is_stored_intact
  FAILED 
tests/test_device.py::TestDeviceFlow::test_full_device_flow_uses_swapped_device_grant_model
  ...
  10 failed, 1151 passed, 1 skipped

Test log: https://autopkgtest.ubuntu.com/results/autopkgtest-
tenacious/tenacious/amd64/d/django-oauth-
toolkit/20261129_041558_bfbeb@/log.gz

Root cause analysis:
Ubuntu's python-oauthlib 3.3.1-2ubuntu1 backports a security fix ('missing 
device_code
validation in the device flow') that adds a new validate_device_code(client_id, 
code, request)
hook to the RFC 8628 device grant validator interface
(oauthlib/oauth2/rfc8628/request_validator.py). django-oauth-toolkit's 
OAuth2Validator does
not implement this hook.

This is the exact same incompatibility already reported and fixed upstream for 
the oauthlib
4.0.1 release:

  https://github.com/django-oauth/django-oauth-toolkit/issues/1950
  ('Device authorization flow breaks with oauthlib 4.0.1', closed)

The fix for that issue (PR 
https://github.com/django-oauth/django-oauth-toolkit/pull/1951)
only landed on django-oauth-toolkit's main/master branch. A backport of that 
fix to the
3.4.x branch (which is what Ubuntu ships) exists as
https://github.com/django-oauth/django-oauth-toolkit/pull/1978 but is **still 
open /
unmerged** upstream as of now.

So this isn't a new bug per se - it's the oauthlib 4.0.1 compatibility issue 
resurfacing
because Ubuntu's security backport to python-oauthlib 3.3.1 independently 
introduces the
same new validator hook requirement that broke things upstream.

Suggested actions:
- Track/encourage upstream PR #1978 to merge the 3.4.x backport, then 
sync/merge the fix
  into Ubuntu's django-oauth-toolkit, or
- Cherry-pick PR #1978's changes directly into Ubuntu's django-oauth-toolkit 
packaging in
  the meantime.

** Affects: django-oauth-toolkit (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: update-excuses

** Tags added: update-excuses

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2178487

Title:
  django-oauth-toolkit 3.4.1: device authorization flow breaks with
  oauthlib's new validate_device_code hook

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/django-oauth-toolkit/+bug/2178487/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to