{"record":{"id":"98a29dd0ed3893ea","repo":"santifer/career-ops","slug":"jobspresso-invalid-url-url","errorCode":null,"errorMessage":"jobspresso: invalid URL: ${url}","messagePattern":"jobspresso: invalid URL: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/jobspresso.mjs","lineNumber":21,"sourceCode":"/** @typedef {import('./_types.js').Provider} Provider */\n\n// Jobspresso provider - public WordPress jobs feed\n// (https://jobspresso.co/?feed=job_feed). The feed is public, no-auth,\n// and XML, so it is parsed in-process with the same tiny tag extractor\n// 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","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/providers/jobspresso.mjs#L3-L39","documentation":"assertJobspressoUrl validates URLs used by the Jobspresso provider (jobspresso.co WordPress job feed). It throws 'invalid URL' when new URL(url) throws — i.e. the string is not a parseable absolute URL. This is the first validation gate (before HTTPS and hostname checks) in the provider's SSRF protections.","triggerScenarios":"Calling assertJobspressoUrl with '', 'jobspresso.co/?feed=job_feed' (no scheme), 'https://', or any string the URL constructor rejects.","commonSituations":"Config entry in portals.yml missing the https:// scheme; an env placeholder left unsubstituted; whitespace or invisible characters contaminating the config value; a relative URL passed where an absolute one is required.","solutions":["Fix the configured URL to a full absolute https:// URL, e.g. https://jobspresso.co/?feed=job_feed","Echo the raw config value (including hidden whitespace) and clean it","Test with new URL(value) in a Node REPL until it parses","Build URLs from the provider's FEED_URL constant instead of hand-typing"],"exampleFix":"// before\nurl: jobspresso.co/?feed=job_feed\n// after\nurl: https://jobspresso.co/?feed=job_feed","handlingStrategy":"validation","validationCode":"function isValidJobspressoUrl(url) {\n  try {\n    const p = new URL(url);\n    return p.protocol === 'https:' && p.hostname === 'jobspresso.co';\n  } catch { return false; }\n}","typeGuard":"function isParseableUrl(v) {\n  return typeof v === 'string' && URL.canParse(v);\n}","tryCatchPattern":"try {\n  assertJobspressoUrl(cfg.url);\n} catch (e) {\n  if (/invalid URL/.test(e.message)) {\n    console.error(`jobspresso entry has a malformed URL: ${JSON.stringify(cfg.url)}`);\n    return [];\n  }\n  throw e;\n}","preventionTips":["Store absolute https:// URLs only in job_boards config","Trim config values; watch for stray whitespace breaking URL parsing","Prefer the provider's FEED_URL constant over hand-typed URLs","Validate portals.yml with verify-pipeline.mjs after edits"],"tags":["url-validation","config","ssrf-protection","nodejs"],"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"}