fix(deps): revert joserfc JWT error migration — fastmcp still uses authlib#40688
Merged
aminghadersohi merged 3 commits intoJun 2, 2026
Merged
Conversation
… to joserfc (apache#40582)" This reverts commit a6d2c95.
richardfogaca
approved these changes
Jun 2, 2026
rusackas
approved these changes
Jun 2, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40688 +/- ##
=======================================
Coverage 63.97% 63.97%
=======================================
Files 2661 2661
Lines 143136 143136
Branches 32909 32909
=======================================
Hits 91569 91569
Misses 49999 49999
Partials 1568 1568
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
Bito Automatic Review Skipped – PR Already Merged |
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.
Summary
Reverts #40582 (
chore(deps): migrate MCP service JWT errors from authlib.jose to joserfc).The migration was premature.
fastmcpthrough at least version 3.3.1 still usesauthlibinternally —JWTVerifier.__init__setsself.jwt = JsonWebToken([self.algorithm])fromauthlib.jose. The SupersetDetailedJWTVerifierinherits this and callsself.jwt.decode(), which raisesauthlib.jose.errors.*exceptions.After #40582, the catch blocks in
DetailedJWTVerifier.load_access_token()were updated to catchjoserfc.errors.*classes, which have a completely separate class hierarchy (authlib.jose.errors.JoseError → AuthlibBaseError → Exceptionvsjoserfc.errors.JoseError → Exception). The authlib exceptions are not caught, propagate through Starlette'sAuthenticationMiddleware(which only catchesAuthenticationError), and produce 500 Internal Server Error instead of 401 for every invalid or expired token.The unit tests in #40582 did not catch this because they mock
self.jwt.decodewithside_effect=joserfc.errors.BadSignatureError()— the mock raises a joserfc exception that IS caught. The real authlib object raises authlib exceptions.Changes
superset/mcp_service/jwt_verifier.py: restoresfrom authlib.jose.errors import; restores original import ordertests/unit_tests/mcp_service/test_jwt_verifier.py: restores authlib-compatible constructor calls (BadSignatureError(result=None),ExpiredTokenError())pyproject.toml: removesjoserfc>=1.0.0,<2.0from fastmcp extrasrequirements/development.txt: removesjoserfc==1.6.8pinWhen to re-do the migration
When a version of
fastmcpwithin the>=3.2.4,<4.0constraint replacesauthlib.jose.JsonWebTokenwith a joserfc-based JWT object internally, the migration can be re-applied. At that pointself.jwt.decode()will raise joserfc exceptions and the catch blocks will match.🤖 Generated with Claude Code