{"record":{"id":"1cd16567103d87a4","repo":"modelcontextprotocol/servers","slug":"domain-domain-is-not-in-the-allowed-domains-lis","errorCode":null,"errorMessage":"Domain ${domain} is not in the allowed domains list.","messagePattern":"Domain (.+?) is not in the allowed domains list\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/everything/tools/gzip-file-as-resource.ts","lineNumber":157,"sourceCode":"    if (\n      url.protocol !== \"http:\" &&\n      url.protocol !== \"https:\" &&\n      url.protocol !== \"data:\"\n    ) {\n      throw new Error(\n        `Unsupported URL protocol for ${dataUri}. Only http, https, and data URLs are supported.`\n      );\n    }\n    if (\n      GZIP_ALLOWED_DOMAINS.length > 0 &&\n      (url.protocol === \"http:\" || url.protocol === \"https:\")\n    ) {\n      const domain = url.hostname;\n      const domainAllowed = GZIP_ALLOWED_DOMAINS.some((allowedDomain) => {\n        return domain === allowedDomain || domain.endsWith(`.${allowedDomain}`);\n      });\n      if (!domainAllowed) {\n        throw new Error(`Domain ${domain} is not in the allowed domains list.`);\n      }\n    }\n  } catch (error) {\n    throw new Error(\n      `Error processing file ${dataUri}: ${\n        error instanceof Error ? error.message : String(error)\n      }`\n    );\n  }\n  return url;\n}\n\n/**\n * Fetches data safely from a given URL while ensuring constraints on maximum byte size and timeout duration.\n *\n * @param {URL} url The URL to fetch data from.\n * @param {Object} options An object containing options for the fetch operation.\n * @param {number} options.maxBytes The maximum allowed size (in bytes) of the response. If the response exceeds this size, the operation will be aborted.","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/modelcontextprotocol/servers/blob/76d64c822f5125032f89eb71dbdb94e42b434821/src/everything/tools/gzip-file-as-resource.ts#L139-L175","documentation":"Thrown by `validateDataURI` when the `GZIP_ALLOWED_DOMAINS` env var is set (non-empty) and the http/https URL's hostname is neither an exact match nor a subdomain of any allowed domain. This is an SSRF-control allowlist; an empty env disables the check entirely.","triggerScenarios":"Operator set `GZIP_ALLOWED_DOMAINS=example.com,github.com` and the tool is called with a URL whose host is e.g. `evil.com` or `notgithub.com` (which is not a subdomain match). The check uses exact hostname match or `.endsWith('.' + allowed)`.","commonSituations":"Misconfigured allowlist (forgot a domain), URL using a bare host vs `www.` variant that isn't covered, or a CDN/redirect domain not in the list. Note: only `endsWith(\".\" + allowed)` — so `evil-example.com` is correctly rejected, but operators must list every domain they intend to permit.","solutions":["Add the exact hostname (and any subdomain-bearing parent) to `GZIP_ALLOWED_DOMAINS`, e.g. `example.com,raw.githubusercontent.com`.","Use a URL whose host is already in the allowlist or a subdomain of one.","To disable domain filtering entirely, leave `GZIP_ALLOWED_DOMAINS` unset/empty (recognize the security trade-off)."],"exampleFix":"# before\nGZIP_ALLOWED_DOMAINS=example.com\ntoolHandler({ data: 'https://raw.githubusercontent.com/x/y/z.md' })\n# after\nGZIP_ALLOWED_DOMAINS=example.com,raw.githubusercontent.com\ntoolHandler({ data: 'https://raw.githubusercontent.com/x/y/z.md' })","handlingStrategy":"validation","validationCode":"const ALLOWED = (process.env.GZIP_ALLOWED_DOMAINS ?? '').split(',').map(d=>d.trim().toLowerCase()).filter(Boolean);\nfunction domainAllowed(url: string): boolean {\n  if (ALLOWED.length === 0) return true;\n  const h = new URL(url).hostname.toLowerCase();\n  return ALLOWED.some(a => h === a || h.endsWith('.' + a));\n}\nif (!domainAllowed(args.data)) { /* surface error */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep GZIP_ALLOWED_DOMAINS in sync with every domain you fetch from.","List parent domains to cover subdomains (example.com covers www.example.com).","Leaving the env empty disables the check — only do so in trusted environments."],"tags":["mcp","typescript","validation","everything-server","security","ssrf","configuration","env"],"backgroundTag":null,"analyzedSha":"76d64c822f5125032f89eb71dbdb94e42b434821","analyzedAt":"2026-08-12T10:02:41.718Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}