Repository navigation
Drop authlib and fetch the access token with httpx - #62
Merged
Merged
Conversation
authlib was only used for one client-credentials token request, but it pulled its whole JOSE/OIDC surface into every customer's dependency tree, along with its advisories (most recently CVE-2026-96760, unpatched). The request is now a plain httpx POST matching what authlib sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vigneshwerv
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A customer's scanner flagged authlib 1.8.0, a transitive dependency of this SDK, for CVE-2026-96760 (CERT/CC VU#762428). It's a JWS signature-verification bypass, rated critical, with no upstream patch. The SDK's code path never reached the vulnerable function: it only used authlib's httpx
OAuth2Client.fetch_tokenfor a client-credentials grant. Still, every customer inherits authlib's whole JOSE/OIDC surface and the scanner alerts that come with it.This replaces authlib with a single httpx POST in
fragment/client/oauth.py. It sends what authlib sent: HTTP Basic client auth (client_secret_basic) and a form body ofgrant_type=client_credentialsandscope.poetry remove authlibalso dropsjoserfc.http_client. The token is cached untilexpires_in, so this runs about once an hour.fragment.exceptions.TokenRequestException(.error,.description) instead of authlib'sOAuthError. A 5xx still raiseshttpx.HTTPStatusError. Theoauth2_clientattribute is gone. Both changes are in the changelog under Unreleased. I'd release this as 1.5.0.fragment/sdk/,fragment/sync_sdk/and the snapshot carry copies of thefragment/client/templates and are updated to match.Testing:
make lint(isort, black, mypy) andmake unitpass (89 tests), andmake check-snapshotsis clean. New offline tests intests/test_oauth.pycover the request shape, error handling and token caching in both clients.tests/test_packaging.pynow fails if authlib reappears in the wheel'sRequires-Dist. The real token exchange against the live auth endpoint has only run through the integration job here. I had no credentials locally, so that job is the check to watch.🤖 Generated with Claude Code