{"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":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/weworkremotely.mjs","lineNumber":25,"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":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/weworkremotely.mjs#L7-L43","documentation":"The weworkremotely provider pins requests to a single trusted host: weworkremotely.com (TRUSTED_HOST). If the URL parses and is https but its hostname differs — mirrors, www-prefixed variants, look-alike domains — assertWwrUrl throws this error. It is an allowlist/SSRF guard: only the genuine feed host is ever contacted.","triggerScenarios":"Configuring a careers_url like 'https://www.weworkremotely.com/remote-jobs.rss', 'https://weworkremotely.com.evil.example/...', 'https://remoteok.com/...' (wrong site), or a typo'd host such as 'weworkremotely.co'. All parse fine and are https, but the hostname does not string-equal 'weworkremotely.com'.","commonSituations":"Adding a www. prefix out of habit, DNS/hosts-file experiments pointing the name elsewhere, phishing or mirror URLs pasted from search results, hostname casing assumptions (hostnames are compared exactly).","solutions":["Use exactly https://weworkremotely.com/remote-jobs.rss — no www prefix, no extra subdomains","Drop the custom careers_url entirely and let the provider use its built-in FEED_URL constant","Check the hostname for typos or look-alike characters; the check is an exact string comparison on parsed.hostname","If a different host is truly needed, change TRUSTED_HOST in providers/weworkremotely.mjs deliberately — never bypass the check in config"],"exampleFix":"// before\ncareers_url: https://www.weworkremotely.com/remote-jobs.rss\n// after\ncareers_url: https://weworkremotely.com/remote-jobs.rss","handlingStrategy":"validation","validationCode":"const TRUSTED_HOST = 'weworkremotely.com';\nconst isTrustedWwrUrl = (url) => {\n  try {\n    const p = new URL(url);\n    return p.protocol === 'https:' && p.hostname === TRUSTED_HOST;\n  } catch { return false; }\n};","typeGuard":"const isWwrHost = (u) => { try { return new URL(u).hostname === 'weworkremotely.com'; } catch { return false; } };","tryCatchPattern":"try {\n  await wwrProvider.fetch(entry, ctx);\n} catch (err) {\n  if (err.message.startsWith('weworkremotely: untrusted hostname')) {\n    console.error(`${entry.name}: only weworkremotely.com is allowed — ${err.message}`);\n    return;\n  }\n  throw err;\n}","preventionTips":["Never add www. or alternate subdomains for this host — the comparison is exact","Rely on the provider default feed URL rather than custom URLs","Treat untrusted-hostname throws as a security signal; investigate where the URL came from","Keep host allowlists in one place (constants) so config and code agree"],"tags":["url-validation","allowlist","ssrf","security"],"backgroundTag":"invalid-url","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}