{"record":{"id":"cb468dfcdc20e1f9","repo":"santifer/career-ops","slug":"jobspresso-untrusted-hostname-parsed-hostname","errorCode":null,"errorMessage":"jobspresso: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}","messagePattern":"jobspresso: untrusted hostname \"(.+?)\" - must be (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/jobspresso.mjs","lineNumber":26,"sourceCode":"// approach as providers/personio.mjs rather than adding an XML dependency.\n//\n// Wire in via a `job_boards:` entry with `provider: jobspresso`.\n\nconst FEED_URL = 'https://jobspresso.co/?feed=job_feed';\nconst TRUSTED_HOST = 'jobspresso.co';\n\n/** @param {string} url */\nfunction assertJobspressoUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`jobspresso: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== \"https:\")\n    throw new Error(`jobspresso: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(\n      `jobspresso: untrusted hostname \"${parsed.hostname}\" - must be ${TRUSTED_HOST}`,\n    );\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\n/** @type {Provider} */\nexport default {\n  id: \"jobspresso\",\n\n  detect(entry) {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/jobspresso.mjs#L8-L44","documentation":"assertJobspressoUrl enforces an exact single-host allowlist: parsed.hostname must equal TRUSTED_HOST ('jobspresso.co'). Any other hostname — subdomains, lookalikes, or internal hosts — is rejected, because these URLs are fetched server-side and the allowlist is the provider's SSRF guard.","triggerScenarios":"Calling assertJobspressoUrl with 'https://www.jobspresso.co/...' (wrong host — note www.), 'https://jobspresso.co.evil.com/...', 'https://localhost/?feed=job_feed', or any hostname !== 'jobspresso.co'.","commonSituations":"Adding 'www.' out of habit; typosquat/mirror domains pasted into config; SSRF attempts naming internal hosts that the allowlist blocks.","solutions":["Use exactly https://jobspresso.co/?feed=job_feed (no www. prefix)","Audit the configured URL for appended/spoofed host segments","To trust another host you must change TRUSTED_HOST in providers/jobspresso.mjs — keep the allowlist strict by default"],"exampleFix":"// before\nurl: https://www.jobspresso.co/?feed=job_feed\n// after\nurl: https://jobspresso.co/?feed=job_feed","handlingStrategy":"validation","validationCode":"function isTrustedJobspressoHost(url) {\n  try { return new URL(url).hostname === 'jobspresso.co'; } catch { return false; }\n}","typeGuard":"function isExactHost(u, host) {\n  return URL.canParse(u) && new URL(u).hostname === host;\n}","tryCatchPattern":"try {\n  assertJobspressoUrl(u);\n} catch (e) {\n  if (/untrusted hostname/.test(e.message)) {\n    console.error(`${e.message} — use https://jobspresso.co/?feed=job_feed`);\n    return [];\n  }\n  throw e;\n}","preventionTips":["Use exactly jobspresso.co — the www. variant is rejected","Copy URLs from the provider's documented FEED_URL rather than from a browser address bar (which may show redirects)","Keep host allowlists strict; do not widen them for untrusted config","Grep configs for hostnames that don't match the allowlist before scanning"],"tags":["url-validation","allowlist","ssrf-protection","security"],"backgroundTag":"invalid-url-format","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"}