{"record":{"id":"d5e293de5d69fb2c","repo":"santifer/career-ops","slug":"weworkremotely-untrusted-hostname-parsed-hostn","errorCode":null,"errorMessage":"weworkremotely: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}","messagePattern":"weworkremotely: untrusted hostname \"(.+?)\" - must be (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/weworkremotely.mjs","lineNumber":24,"sourceCode":"// and XML, so it is parsed in-process with the same tiny tag extractor approach\n// as providers/personio.mjs rather than adding an XML dependency.\n//\n// Wire in via a `job_boards:` entry with `provider: weworkremotely`.\n\nconst FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';\nconst TRUSTED_HOST = 'weworkremotely.com';\n\n/** @param {string} url */\nfunction assertWwrUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`weworkremotely: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`weworkremotely: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`weworkremotely: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\n// NaN-safe Date.parse - `|| undefined` would also coerce a valid epoch 0.\nfunction toEpochMs(value) {\n  if (!value) return undefined;\n  const parsed = Date.parse(value);\n  return Number.isNaN(parsed) ? undefined : parsed;\n}\n\nfunction fallbackCompany(entry) {\n  return typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : 'We Work Remotely';\n}\n\n/** @type {Provider} */\nexport default {\n  id: 'weworkremotely',","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/weworkremotely.mjs#L6-L42","documentation":"SSRF guard: the URL parsed and is https, but its hostname is not exactly weworkremotely.com. Stops a tampered feed URL from exfiltrating requests to another host. Runtime redirects are already blocked by redirect: \"error\" on the fetch, so this guards the constant itself.","triggerScenarios":"Reached with the FEED_URL constant; fires if a maintainer points it at a different host (e.g. a staging mirror or look-alike domain).","commonSituations":"FEED_URL edited to a staging mirror; a bad merge; the We Work Remotely feed moved and TRUSTED_HOST was not updated in step.","solutions":["Restore hostname to weworkremotely.com.","If WWR ever moves the feed, update TRUSTED_HOST and FEED_URL together."],"exampleFix":"// before\nconst FEED_URL = 'https://feeds.example.com/wr.rss';\n// after\nconst FEED_URL = 'https://weworkremotely.com/remote-jobs.rss';","handlingStrategy":"validation","validationCode":"const TRUSTED_HOST = 'weworkremotely.com';\nif (new URL(FEED_URL).hostname !== TRUSTED_HOST)\n  throw new Error(\"weworkremotely: hostname drifted from TRUSTED_HOST\");","typeGuard":"const isTrustedHost = (s, h) => { try { return new URL(s).hostname === h; } catch { return false; } };","tryCatchPattern":null,"preventionTips":["Keep TRUSTED_HOST and FEED_URL adjacent so they are updated together.","Reject runtime redirects (already done via redirect: \"error\") so only the constant can drift."],"tags":["validation","url","ssrf-guard","hostname","weworkremotely","invariant"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}