@socketsecurity/mcp 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -249,13 +249,15 @@ if (useHttp) {
249
249
  'https://mcp.socket-staging.dev'
250
250
  ];
251
251
  const host = req.headers.host || '';
252
- const isLocalhostHost = host === `localhost:${port}` ||
252
+ const allowedHosts = allowedOrigins.map(o => new URL(o).hostname);
253
+ const isAllowedHost = host === `localhost:${port}` ||
253
254
  host === `127.0.0.1:${port}` ||
254
255
  host === 'localhost' ||
255
- host === '127.0.0.1';
256
+ host === '127.0.0.1' ||
257
+ allowedHosts.includes(host);
256
258
  const isValidOrigin = origin
257
259
  ? (isLocalhostOrigin(origin) || allowedOrigins.includes(origin))
258
- : isLocalhostHost;
260
+ : isAllowedHost;
259
261
  if (!isValidOrigin) {
260
262
  logger.warn(`Rejected request from invalid origin: ${origin || 'missing'} (host: ${host})`);
261
263
  res.writeHead(403, { 'Content-Type': 'application/json' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/mcp",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {