{"record":{"id":"3322aabccc6ba045","repo":"santifer/career-ops","slug":"yourator-untrusted-hostname-parsed-hostname","errorCode":null,"errorMessage":"yourator: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_HOST}","messagePattern":"yourator: untrusted hostname \"(.+?)\" — must be (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/yourator.mjs","lineNumber":85,"sourceCode":"const FEED_BASE = `${SITE_ORIGIN}/api/v4/jobs`;\nconst TRUSTED_HOST = 'www.yourator.co';\n// Safety bound only — the loop stops on payload.hasMore. The live board was 88\n// pages on 2026-08-18; this leaves room to grow without silently truncating.\nconst DEFAULT_MAX_PAGES = 120;\nconst MAX_PAGES_CAP = 500;\nconst PAGE_DELAY_MS = 200;\n\n/** @param {string} url */\nfunction assertYouratorUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`yourator: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`yourator: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`yourator: untrusted hostname \"${parsed.hostname}\" — must be ${TRUSTED_HOST}`);\n  }\n  return url;\n}\n\n/** Resolve the page cap: a positive integer `max_pages` on the entry, capped. */\nfunction resolveMaxPages(entry) {\n  const v = entry?.max_pages;\n  if (Number.isInteger(v) && v > 0) return Math.min(v, MAX_PAGES_CAP);\n  return DEFAULT_MAX_PAGES;\n}\n\n/**\n * Canonical URL for a posting — Source Indexing Policy rule 2, \"the shortest\n * verifiable path to the employer the source exposes\".\n *\n * Prefers `thirdPartyUrl` (the employer's own ATS page), with the board's\n * `utm_*` ad parameters stripped. Accepts any https: origin — the value is\n * display-only and never fetched here. Falls back to the Yourator posting page","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/yourator.mjs#L67-L103","documentation":"assertYouratorUrl pins the hostname to TRUSTED_HOST (yourator.net): any successfully parsed HTTPS URL whose hostname differs throws this error. This is an SSRF/confusion guard — it ensures the provider can never be pointed at an attacker-controlled domain that merely looks like a Yourator link. The message names the offending hostname and the required host.","triggerScenarios":"Passing https://evil.example.com/... , a lookalike domain (yourator.com, yourator.net.evil.io), a subdomain like www.yourator.net, or a URL built from unvalidated user input.","commonSituations":"Config entries pointing at mirrors or staging domains; username/host confusion after parsing a company's custom share URL; typosquat domains; redirect chains that would land off-host (intercepted earlier by redirect:'error' but blocked here first).","solutions":["Change the URL's hostname to exactly the TRUSTED_HOST value (yourator.net) — no www or subdomains","If a legitimate new official domain appears, update TRUSTED_HOST in providers/yourator.mjs deliberately, after verifying ownership","Strip any path/host rewriting from upstream code so only trusted, canonical Yourator URLs reach this function","Treat this error as a security signal: audit where the URL originated before simply swapping it"],"exampleFix":"// before\nconst url = 'https://www.yourator.net/companies/acme';\n// after\nconst url = 'https://yourator.net/companies/acme';","handlingStrategy":"validation","validationCode":"const u = new URL(candidateUrl);\nconst TRUSTED_HOST = 'yourator.net';\nif (u.hostname !== TRUSTED_HOST) {\n  throw new Error(`refusing non-trusted host: ${u.hostname}`);\n}","typeGuard":"function isTrustedYouratorUrl(s) {\n  try { return new URL(s).hostname === 'yourator.net'; } catch { return false; }\n}","tryCatchPattern":"try {\n  await scanYourator(entry);\n} catch (e) {\n  if (e.message.startsWith('yourator: untrusted hostname')) {\n    console.warn('Only exact yourator.net URLs are allowed (SSRF guard) — check the configured hostname for typos/lookalikes.');\n  } else throw e;\n}","preventionTips":["Pin exact hostname (no www, no subdomains) in all configured URLs","Treat this error as a potential security signal — audit where the URL came from","Never disable TRUSTED_HOST checking to \"make it work\"","If yourator moves domains, verify ownership and update TRUSTED_HOST deliberately"],"tags":["url","ssrf","security","yourator"],"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"}