Security: require 'audience' for jwt auth (RFC 8707 confused-deputy defense)#5
Merged
Merged
Conversation
… defense) fastmcp's JWTVerifier accepts audience=None and then SKIPS audience validation. mk_auth_provider passed the caller's audience straight through, so omitting it silently disabled the RFC 8707 audience binding — a token minted for another service could be replayed against this server (confused-deputy). For a helper whose whole job is to build a SECURE resource server, that fail-open default is wrong: now 'audience' is required for type='jwt' and a missing one raises a clear error. Also sync pyproject version to 0.1.5 (PyPI already has 0.1.5 from the http merge; the wads auto-bump never pushed the bump back) so the next publish is 0.1.6. Found by an adversarial security review of the remote-connector work. +1 test.
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.
What
fastmcp'sJWTVerifieracceptsaudience=Noneand then skips audience validation.mk_auth_providerpassed the caller'saudiencestraight through, so omitting it silently disabled the RFC 8707 audience binding — a token minted for another service could be replayed against this server (confused-deputy).For a helper whose entire purpose is to build a secure OAuth 2.1 resource server, that fail-open default is wrong. Now
audienceis required fortype='jwt'; a missing one raises a clear, educational error.Also
Syncs
pyproject.tomlversion0.1.4 → 0.1.5— PyPI already has 0.1.5 (published when the http feature merged), but the wads auto-bump never pushed the version bump back to main (the known push-back desync). Without this, the next merge would try to re-publish 0.1.5 and fail; with it, the bump lands on 0.1.6.Why now
Found by an adversarial security review of coact's remote-connector work (which builds on this layer). coact always supplies an audience, so it is unaffected — this hardens the helper against any caller.
Tests
+1 regression test (
test_missing_audience_raises); full suite 20 passed; ruff clean.