-
Notifications
You must be signed in to change notification settings - Fork 227
internal/oauthex: address URL attacks in PRM #539
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
Conversation
Fix Protected Resource Metadata to prevent URL attacks, as described in the issue. For modelcontextprotocol#526
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.
This LGTM (though I have only superficial knowledge of the problem).
However, changes like this should include a test.
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.
Approved with one documentation comment, should probably also have a test.
return err | ||
} | ||
scheme := strings.ToLower(uu.Scheme) | ||
if scheme == "javascript" || scheme == "data" || scheme == "vbscript" { |
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.
My guess is that we can't just blanket block everything except http(s), because it's plausible that some servers may want to authenticate using a custom app protocol, but that is a little worrying, since it's not immediately clear to me that those couldn't similarly be used for attacks.
I see this is what other SDKs have done though, so perhaps this is the best option we have. There should at least be a comment here explaining why we block these particular schemes, and why we cannot just only allow http(s).
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.
I got the list of schemes from https://github.com/modelcontextprotocol/typescript-sdk/pull/877/files#diff-a0fe23c86bd448c6fa4c60fe4d380daa65451fea86a9e760673a5a7c65292e88, line 20. There's no explanation in that PR for where that list comes from. Clearly, they are all suspect, but I don't know if there are other suspect schemes as well. However, the article you cited, https://verialabs.com/blog/from-mcp-to-shell, seems to think that the above PR is sufficient. (See the section called the most impactful fix.}
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.
Seems fine with me. I think we should document that somewhere though.
Can we land this today? Would be good to include in the next release (planned soon). |
I merged this, but the comments should be addressed in a follow up. @samthanawalla |
Fix Protected Resource Metadata to prevent URL attacks, as described in the issue.
For #526