{"record":{"id":"e5542923bef24ace","repo":"Kong/insomnia","slug":"failed-to-resolve-href-only-https-urls-to-pu","errorCode":null,"errorMessage":"Failed to resolve \"${href}\". Only https URLs to public hosts are allowed.","messagePattern":"Failed to resolve \"(.+?)\"\\. Only https URLs to public hosts are allowed\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/insomnia-inso/src/commands/lint-specification.ts","lineNumber":51,"sourceCode":"}\n\n// Block hosts that resolve to private/loopback addresses (e.g. *.localtest.me → 127.0.0.1),\n// Note: This is duplicated in insomnia's main/lint-process.mjs. Remember to mirror changes there as well.\nasync function assertResolvesToPublicHost(hostname: string): Promise<void> {\n  const records = await dns.lookup(hostname, { all: true });\n  for (const { address } of records) {\n    if (isPrivateOrLoopbackHost(address)) {\n      throw new Error(`Failed to resolve host. \"${hostname}\" resolves to a private or loopback address.`);\n    }\n  }\n}\n\n// Note: This is duplicated in insomnia's main/lint-process.mjs. Remember to mirror changes there as well.\nconst safeHttpResolver = {\n  async resolve(ref: { href: () => string }): Promise<string> {\n    const href = ref.href();\n    if (!isSafeRefUrl(href)) {\n      throw new Error(`Failed to resolve \"${href}\". Only https URLs to public hosts are allowed.`);\n    }\n    await assertResolvesToPublicHost(new URL(href).hostname.toLowerCase());\n    const response = await fetch(href, { redirect: 'error', signal: AbortSignal.timeout(10_000) });\n    if (!response.ok) {\n      throw new Error(`Failed to fetch \"${href}\": ${response.status} ${response.statusText}`);\n    }\n    return response.text();\n  },\n};\n\nexport const safeRefResolver = new Resolver({\n  resolvers: {\n    http: safeHttpResolver,\n    https: safeHttpResolver,\n  },\n});\n\nexport const getRuleSetFileFromFolderByFilename = async (filePath: string) => {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia-inso/src/commands/lint-specification.ts#L33-L69","documentation":"Error \"Failed to resolve \"${href}\". Only https URLs to public hosts are allowed.\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia-inso/src/commands/lint-specification.ts:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}