-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(auth): prevent javascript url injection in oauth endpoints #841
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?
fix(auth): prevent javascript url injection in oauth endpoints #841
Conversation
Is there a situation where an authorization server could be behind a custom protocol? For example raycast uses |
@paoloricciuti another option is to selectively disallow certain schemes like |
Yeah exactly my thought...also technically nothing prevents the MCP server to specify a authorization url that lead to a page with malicious JS even if the protocol was https |
I guess if it specifies a url of a page containing malicious JS, the risk is relatively contained because the page context is of different origin. Opposed to, for example, for example:
|
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.
hey thanks for this.
I'd rather we validate the metadata on fetch, and reject it there than have to chase every time its used
Updated |
Added URL scheme validation to OAuth endpoints to prevent JavaScript URL injection attacks. Only
http:
andhttps:
schemes are now allowed in OAuth authorization server metadata.Motivation and Context
Malicious authorization servers could return OAuth endpoints with dangerous URL schemes (like
javascript:
,data:
,file:
) that could lead to XSS/RCE attacks when processed by OAuth clients.The attack flow:
{"authorization_endpoint": "javascript:alert('XSS')"}
How Has This Been Tested?
http
orhttps
scheme as authorization endpointsTypes of changes
Checklist