Sourced from oauthlib's releases.
4.0.1
Security
- CVE-2026-49272 / GHSA-3jp2-3mrg-2vxc: The device code flow token endpoint did not validate the
device_codeparameter. A request with a knownclient_idand a bogusdevice_codecould obtain a bearer token.DeviceCodeGrant.validate_token_requestnow callsDeviceCodeGrant.validate_device_code(), which rejects missing or unknown device codes (invalid_request/invalid_grant) and delegates the code's authorization status to the newRequestValidator.validate_device_code()hook, per RFC 8628 Section 3.5. (cherry-picked from #954)Upgrade note for device flow integrators
Custom
RequestValidatorimplementations using the device flow must now implementvalidate_device_code(client_id, code, request). Return one of theDeviceCodeGrant.DEVICE_CODE_*statuses for known codes, orNonefor an unknown code. When returningAUTHORIZED, the validator must also populaterequest.userandrequest.scopesfrom the stored authorization.
Sourced from oauthlib's changelog.
4.0.1 (2026-11-04):
OAuth2.0 Provider (Security):
Security: CVE-2026-49272 / GHSA-3jp2-3mrg-2vxc: The device code flow token endpoint did not validate the
device_codeparameter. A request with a knownclient_idand a bogusdevice_codecould obtain a bearer token.DeviceCodeGrant.validate_token_requestnow calls a newDeviceCodeGrant.validate_device_code()which rejects missing or unknown device codes (400 invalid_request/400 invalid_grant) and delegates the code's authorization status to a new requiredRequestValidator.validate_device_code()hook, per RFC 8628 Section 3.5. (cherry-picked from #954, merged as 1c91d64)Upgrade note for device flow integrators: custom
RequestValidatorimplementations using the device flow must now implementvalidate_device_code(client_id, code, request). Return one of theDeviceCodeGrant.DEVICE_CODE_*statuses (AUTHORIZED,PENDING,SLOW_DOWNorEXPIRED) for known codes, orNonefor an unknown code. When returningAUTHORIZED, the validator must also populaterequest.userandrequest.scopesfrom the stored authorization.
6e3aa05
Release 4.0.1: fix CVE-2026-49272 (device_code validation in device
flow)77a5f1c
Merge pull request #954
from hekhuisk/improve-device-workflow