-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix OAuthProxyProviderClient validation #620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
sync upstream
Hi, any update here? We currently have to patch the dependency when we deploy as the library doesn't work for us unless we have it |
Hi @izqui, thanks for sending this out! I'm trying to understand the kind of proxy this unlocks, could you share a bit more about the use cases? Also, it would be good to add tests for the various new combinations introduced here (the PR's description mentions new tests - missing from branch? - and previously-failing tests, could you please clarify?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @izqui, thanks for sending this out!
I'm trying to understand the kind of proxy this unlocks, could you share a bit more about the use cases?
Also, it would be good to add tests for the various new combinations introduced here (the PR's description mentions new tests - missing from branch? - and previously-failing tests, could you please clarify?)
Sorry for the confusion regarding the tests, it was during a work in progress that some existing tests broke. Our usecase for the proxy is one in which the mcp just forwards all oauth requests/registration to an upstream oauth server. The modifications in the code simply disable any kind of local checks (bypassing the Would be happy to add tests for this new behavior if helpful (we are running in prod with it ourselves) |
This PR fixes OAuth proxy provider functionality by adding configurable validation controls and resolving overly permissive client validation that was breaking tests and compromising security.
Motivation and Context
The core issue was that for stateless proxy setups, you want to:
undefined
fromgetClient
since you don't store client information locallyBut this wasn't properly configurable and was affecting non-proxy scenarios.
How Has This Been Tested?
getClient
returnsundefined
) and stateful configurationsTest scenarios covered:
skipLocalClientValidation: true
)Breaking Changes
No breaking changes - this is fully backward compatible:
ProxyOAuthServerProvider
instances continue to work exactly as before (defaults toskipLocalClientValidation: true
andskipLocalPkceValidation: true
)Types of changes
Checklist
Additional context
Key changes made:
Added configurable validation properties to
OAuthServerProvider
interface:Enhanced
ProxyOptions
to accept these configuration flags:Updated client authentication middleware to respect the
allowFallbackClient
flag, which is derived from the provider'sskipLocalClientValidation
setting.Fixed authorize handler to only create fallback clients when explicitly configured to do so.
Added comprehensive documentation showing how to configure stateless proxy setups:
Design decisions:
This resolves the tension between supporting stateless proxy scenarios while maintaining security for standard OAuth implementations.