Fix OAuthProxyProviderClient validation #620
Open
+104
−23
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.
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.