-
Notifications
You must be signed in to change notification settings - Fork 644
feat(cors): Add CORS policy check and response to browsers. #450
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
b21f59d
to
770eae1
Compare
config.d.ts
Outdated
/** | ||
* Origins to allow by CORS policy. Can be regex. | ||
*/ | ||
corsAllowOrigins?: RegExp[]; |
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 rather belongs to the 'server' section.
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.
Good suggestion. Moved to the server.
src/transport.ts
Outdated
if (origin === undefined) | ||
return false; | ||
|
||
if (config.network.corsAllowOrigins.some(re => re.test(origin))) { |
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.
What is your use case? This exposes universal access to the host machine to the client, including full access to the fs.
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.
We have a browser based "agent prototype" which connects to the localhost playwright-mcp. By default browsers will not allow connection because of CORS policies. So for now user starts playwright-mcp on his machine, adds "agent url" to allowed origins and then connection can be made.
No description provided.