chore(extensions): allow connections only from 127.0.0.1 (#1275)

Requires https://github.com/microsoft/playwright/pull/38626
This commit is contained in:
Yury Semikhatsky
2025-12-19 18:42:34 -08:00
committed by GitHub
parent 0a6f1c4ea4
commit a0b4ffbe15

View File

@@ -44,8 +44,18 @@ const ConnectApp: React.FC = () => {
const relayUrl = params.get('mcpRelayUrl');
if (!relayUrl) {
setShowButtons(false);
setStatus({ type: 'error', message: 'Missing mcpRelayUrl parameter in URL.' });
handleReject('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;
}