mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2026-02-03 08:53:38 +00:00
chore(extensions): allow connections only from 127.0.0.1 (#1275)
Requires https://github.com/microsoft/playwright/pull/38626
This commit is contained in:
@@ -44,8 +44,18 @@ const ConnectApp: React.FC = () => {
|
|||||||
const relayUrl = params.get('mcpRelayUrl');
|
const relayUrl = params.get('mcpRelayUrl');
|
||||||
|
|
||||||
if (!relayUrl) {
|
if (!relayUrl) {
|
||||||
setShowButtons(false);
|
handleReject('Missing mcpRelayUrl parameter in URL.');
|
||||||
setStatus({ type: 'error', message: 'Missing mcpRelayUrl parameter in URL.' });
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const host = new URL(relayUrl).hostname;
|
||||||
|
if (host !== '127.0.0.1' && host !== '[::1]') {
|
||||||
|
handleReject(`MCP extension only allows loopback connections (127.0.0.1 or [::1]). Received host: ${host}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
handleReject(`Invalid mcpRelayUrl parameter in URL: ${relayUrl}. ${e}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user