fix(oauth): drop .strict() from dyn-reg schema per RFC 7591 §3.2#157
Merged
fix(oauth): drop .strict() from dyn-reg schema per RFC 7591 §3.2#157
Conversation
RFC 7591 §3.2 requires servers to silently ignore unrecognised metadata fields. The .strict() guard caused a 400 for clients sending application_type (IANA-registered field, e.g. Claude Code). Zod's default strip mode accepts and silently discards unknown fields, which matches the spec requirement. Adds a test confirming application_type + custom extensions are stripped without error and do not appear in the response. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
View your CI Pipeline Execution ↗ for commit e08ac12
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Code Review
This pull request updates the dynamic client registration schema to comply with RFC 7591 §3.2 by allowing and stripping unrecognized metadata fields instead of rejecting them. Specifically, the ".strict()" constraint was removed from the dynamicClientRegistrationRequestSchema in oauth.ts, and a corresponding test case was added to register.test.ts to verify that unrecognized fields are correctly ignored. I have no feedback to provide.
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
.strict()violated this by returning a 400 for any unknown keyapplication_type: "native"— a valid IANA-registered field absent from our explicit allow-list, which triggered the failure.strict(); Zod's default strip mode accepts and silently discards unrecognised fields, matching the RFCCaught by the end-to-end smoke test in majordomo scripts/smoke-oauth-chain.sh (section 2 was the only remaining failure after the full OAuth 2.1 stack landed in #156).
Test plan
register.test.tssuite still passes (no regressions)application_type: "native"+ custom extension returns201withclient_id, noclient_secret, no echoed unknown fieldsscripts/smoke-oauth-chain.sh --tailscalesection 2 passes green🤖 Generated with Claude Code