Repository navigation
Release 3.1.0.post1: CVE-2026-118669, CVE-2026-49264 and CVE-2026-49265 for the Python 2.7 line - #1
Conversation
GHSA-7984-qgvg-3j9c. The client_credentials and password grants authenticated one client and then kept a client_id from the request body (request.client_id or request.client.client_id), so an authenticated low-privilege client could name another client and have the grant type and scopes validated as that client. Both grants now take client_id from request.client after authentication. A different client_id in the request raises ServerError, as upstream does. In client_credentials the binding now happens before validate_grant_type. Backported from upstream c951a1d (oauthlib 4.0.0), narrowed to the two grants the advisory names: upstream also reorganised authorization_code, refresh_token and device_code, where the code or refresh token is already validated against request.client, and that reorganisation changes 3.1.0 behaviour for public clients. test_scope_handling's fixture gets upstream's change (its validate_user set mismatched ids). Co-Authored-By: Claude <[email protected]>
GHSA-hj66-6f7g-4r5v. With enable_jsonp=True, RevocationEndpoint wrote the request's callback parameter into the response body unchecked, on both the success and the error path, so a caller could make the endpoint return arbitrary JavaScript. The callback is now used only when it is a dotted JavaScript identifier (package.callback); otherwise the response is the plain body, as if no callback had been given. Upstream fixed this by removing JSONP support (c888359, oauthlib 4.0.0, PR oauthlib#951). That removes the enable_jsonp parameter, which would break callers of a post-release, so this backport keeps the parameter and restricts the callback instead. Co-Authored-By: Claude <[email protected]>
GHSA-xpv3-w29h-x7cv. code_challenge_method_plain and code_challenge_method_s256 compared the verifier (or its S256 digest) with the stored challenge using ==, which stops at the first differing character and so leaks the length of the matching prefix. Both now use oauthlib.common.safe_string_equals, oauthlib's existing constant-time comparison. Backported from upstream PR oauthlib#963 (74664d3, oauthlib 4.0.0), which uses hmac.compare_digest. That needs Python 2.7.7 and rejects mixed str and unicode arguments on Python 2, so the backport uses the helper oauthlib already ships for signature checks. Co-Authored-By: Claude <[email protected]>
… for the Python 2.7 line Co-Authored-By: Claude <[email protected]>
ezequielp-activestate
left a comment
There was a problem hiding this comment.
Approve: 0 blockers.
🔴 Blockers
None.
Checked
-
The base
31cae75c9dis the upstreamv3.1.0tag. -
_bind_client_idhas the same logic as the binding in upstream c951a1d'svalidate_client_confidential/validate_client_public: fillclient_idfromrequest.clientwhen it's empty, and raiseServerErrorwhen it differs.- In both grants, the binding now runs before
validate_grant_type. - Limiting the fix to
client_credentialsandpasswordmatches the advisory, which names only those two grants.
-
CVE-2026-49264: the
_JSONP_CALLBACK_REcheck (dotted identifier, anchored with\Z) guards both the error and the success paths.- Upstream's 8f7db80 (the client side refusing
callback=) only follows from upstream removing JSONP, so it isn't needed while JSONP is kept.
- Upstream's 8f7db80 (the client side refusing
-
CVE-2026-49265: both PKCE methods now use
common.safe_string_equals. It's safe on Python 2 with mixedstr/unicode, and it's only reached whencode_challenge is not None. -
Upstream follow-ups: I checked the upstream history after the fixes, through
v4.0.1and master.- 4.0.1's CVE-2026-49272 and master's 5edac41 are in the device flow, which 3.1.0 doesn't have.
- a34239c (
host_from_uriIPv6) is a functional fix, not a security one.
-
OSV: for oauthlib 3.1.0, it lists exactly these three advisories.
-
Tests:
base + this PR's tests PR Python 2.7 9 failed, 547 passed 556 passed Python 3.8 9 failed, 547 passed 556 passed On both versions, every base failure is a new regression test, and the PR passes all of them.
-
Probe on Python 2.7:
base PR client_credentialsrequest authenticated aslowwithclient_id=adminin the body200, and validate_grant_typereceivedadmin400 before validate_grant_typerunsRevocation with callback=alert(document.cookie)//body alert(document.cookie)//();empty body Revocation with callback=pkg.cbpkg.cb();pkg.cb(); -
Build:
setup.py sdist bdist_wheelgivesoauthlib-3.1.0.post1.tar.gzandoauthlib-3.1.0.post1-py2.py3-none-any.whl, andoauthlib.__version__is3.1.0.post1.
⚪ Notes
safe_string_equalsreturns early when the lengths differ, so the comparison time still reveals whether the length is right.hmac.compare_digestupstream behaves the same way, so this matches upstream.
Not assessed
- I didn't measure PKCE comparison timing.
- I didn't run the docs build.
oauthlib 3.1.0 is the last release line that supports Python 2.7. Upstream fixed these three advisories in 4.0.0, which requires Python 3. This backports them as 3.1.0.post1, one commit per CVE. The base branch
3.1.0.xis the upstreamv3.1.0tag.client_idbound to the authenticated clientWhere this differs from upstream
Each difference keeps 3.1.0's API, so a post-release doesn't break callers.
client_credentialsandpasswordgrants now takeclient_idfromrequest.clientafter authentication. A differentclient_idin the body raisesServerError, as upstream does. Inclient_credentials, the binding now happens beforevalidate_grant_type.authorization_code,refresh_tokenanddevice_code. In those grants the code or refresh token is already validated againstrequest.client.test_scope_handling's fixture gets upstream's own change: itsvalidate_userset mismatched ids.enable_jsonpparameter, so instead the callback is now used only when it is a dotted JavaScript identifier (package.callback). Otherwise the endpoint returns the plain body.hmac.compare_digest. That needs Python 2.7.7 and rejects mixedstr/unicodearguments on Python 2, so the backport uses oauthlib's existingcommon.safe_string_equals.Tests
v3.1.0has the same 7 failures (blinker not installed, and other environment issues).setup.py sdist bdist_wheelgivesoauthlib-3.1.0.post1.tar.gzandoauthlib-3.1.0.post1-py2.py3-none-any.whl.Tracking: Linear PROD-2448.