-
Notifications
You must be signed in to change notification settings - Fork 53
Feature: adds security to the OAuth registration endpoint #87
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
Feature: adds security to the OAuth registration endpoint #87
Conversation
|
Thanks for submitting a PR! Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
42cf6d4 to
9ba0c1f
Compare
|
Maybe another way would be to be able to set or override middleware and middleware groups on these routes by configuration ? In my project I'm using spatie/csp package to have more control on what CSP I want to use on specific route. |
f8b9aaf to
7cb733e
Compare
That’s a good idea. However, I think adding redirect domain whitelists as a configuration option makes it simpler for developers to implement, while also signalling that this is a recommended best practice. |
|
Some formatting things that would need to be fixed here. |
@taylorotwell - Is there anything specific? The |
9551868 to
a4bbb73
Compare
Have had a stab at some reformatting 🤞 |
|
Please consider RFC 7591: OAuth 2.0 Dynamic Client Registration Protocol:
|
A few points here are out of the scope of this PR IMO. I am just trying to provide some protection to the register endpoint. |
|
I think the request parameter client_name got accidentally changed to name The tests pass because not typehints are on the fake registry, but in practice they fail. My colleague has added a fix in #104 |
This PR enhances the OAuth client registration endpoint by adding validation and configurable redirect domain restrictions.
Changes
config/mcp.phpwith:allow_all_redirect_domains— toggle to allow all redirect domains.allowed_redirect_domains— list of whitelisted domains.Benefits
This is effectively the only meaningful security enforcement available within the MCP specification, which otherwise does not provide mechanisms for authenticating or authorizing clients during registration.
Notes
I have not validated client name as this could be a breaking change to users who have overwritten the default of Passport functionality.