{"record":{"id":"df5523b39142d24f","repo":"mihomo-party-org/clash-party","slug":"plugin-url-must-use-https","errorCode":null,"errorMessage":"Plugin URL must use https","messagePattern":"Plugin URL must use https","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/resolve/plugin/remote.ts","lineNumber":13,"sourceCode":"import { getAppConfig } from '../../config/app'\nimport { MAX_PLUGIN_FILE_BYTES } from './constants'\nimport { requestOnce } from './http-client'\nimport { createGuardedLookup, isForbiddenHost } from './net-guard'\n\nfunction parseDownloadUrl(url: string): URL {\n  let parsed: URL\n  try {\n    parsed = new URL(url)\n  } catch {\n    throw new Error('Invalid plugin URL')\n  }\n  if (parsed.protocol !== 'https:') throw new Error('Plugin URL must use https')\n  if (parsed.username || parsed.password) throw new Error('Plugin URL must not contain userinfo')\n  if (parsed.hash) throw new Error('Plugin URL must not contain a fragment')\n  if (isForbiddenHost(parsed.hostname)) throw new Error('Plugin URL must use a public host')\n  return parsed\n}\n\nexport async function fetchRemotePlugin(url: string): Promise<string> {\n  const parsed = parseDownloadUrl(url)\n  const { subscriptionTimeout = 30000, pluginUseProxy } = await getAppConfig()\n  let proxy: { host: string; port: number } | undefined\n  if (pluginUseProxy) {\n    const { getControledMihomoConfig } = await import('../../config/controledMihomo')\n    const { 'mixed-port': port = 7890 } = await getControledMihomoConfig()\n    proxy = { host: '127.0.0.1', port }\n  }\n\n  const response = await requestOnce(parsed.toString(), {\n    method: 'GET',","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/resolve/plugin/remote.ts#L1-L31","documentation":"After parsing succeeds, parseDownloadUrl requires the protocol to be exactly https:. Any other scheme (http:, ftp:, file:) is rejected with 'Plugin URL must use https' to guarantee plugin downloads are fetched over TLS.","triggerScenarios":"Passing a download URL whose protocol is not https — most commonly an http:// mirror link, or a file:// URL for a local file.","commonSituations":"Old or internal mirror links still using http; user pastes a local file:// path; copying an insecure download link from docs.","solutions":["Switch the source to an https:// URL (use https mirror or CDN link).","Upgrade an internal http server to TLS, or use an https reverse proxy.","If the content is local, install it through the local-file plugin path instead of fetchRemotePlugin."],"exampleFix":"// before\nawait fetchRemotePlugin('http://mirror.example.com/plugin.yaml')\n// after\nawait fetchRemotePlugin('https://mirror.example.com/plugin.yaml')","handlingStrategy":"validation","validationCode":"const u = new URL(input)\nif (u.protocol !== 'https:') throw new Error('download URL must start with https://')","typeGuard":"const isHttpsUrl = (s: string): boolean => {\n  try { return new URL(s).protocol === 'https:' } catch { return false }\n}","tryCatchPattern":"try {\n  await fetchRemotePlugin(input)\n} catch (e) {\n  if (e.message === 'Plugin URL must use https') {\n    showUrlInputError('Only https:// download links are supported')\n  } else throw e\n}","preventionTips":["Only distribute https mirror links","Migrate internal http servers to TLS","Route local content through the local-file install path, not fetchRemotePlugin"],"tags":["url","https","security","validation"],"backgroundTag":"insecure-url-scheme","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}