{"record":{"id":"fd22a60af5b0b5cb","repo":"santifer/career-ops","slug":"arbeitnow-invalid-url-url","errorCode":null,"errorMessage":"arbeitnow: invalid URL: ${url}","messagePattern":"arbeitnow: invalid URL: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"providers/arbeitnow.mjs","lineNumber":30,"sourceCode":"// scan.mjs's title_filter then gates on the configured titles. Pages are fetched\n// until one comes back short/empty or the page cap is reached (default 3,\n// override with `max_pages` on the portal entry).\n//\n// Wire in via a `job_boards:` entry with `provider: arbeitnow`.\n\nconst FEED_BASE = 'https://www.arbeitnow.com/api/job-board-api';\nconst TRUSTED_HOST = 'www.arbeitnow.com';\nconst PER_PAGE = 100;\nconst DEFAULT_MAX_PAGES = 3;\nconst MAX_PAGES_CAP = 50;\n\n/** @param {string} url */\nfunction assertArbeitnowUrl(url) {\n  let parsed;\n  try {\n    parsed = new URL(url);\n  } catch {\n    throw new Error(`arbeitnow: invalid URL: ${url}`);\n  }\n  if (parsed.protocol !== 'https:') throw new Error(`arbeitnow: URL must use HTTPS: ${url}`);\n  if (parsed.hostname !== TRUSTED_HOST) {\n    throw new Error(`arbeitnow: 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 * Normalize a single Arbeitnow job. Exported for unit tests.\n *","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/providers/arbeitnow.mjs#L12-L48","documentation":"The arbeitnow provider validates every URL through `assertArbeitnowUrl` before fetching. The 'invalid URL' variant fires when `new URL(url)` itself throws — the input is not parseable as an absolute URL. In the current code path it is called on the constant `FEED_BASE`, so in practice it guards against a tampered/overridden base URL or a future caller passing user input.","triggerScenarios":"`assertArbeitnowUrl(url)` is called with a string that `new URL()` cannot parse: a schemeless host (`www.arbeitnow.com/api`), a protocol-relative URL (`//www.arbeitnow.com`), an empty string, or a value containing illegal characters.","commonSituations":"Overriding `FEED_BASE` with a relative or schemeless string, env/config injection that strips the `https://` scheme, or wiring user-supplied URLs into the fetch path.","solutions":["Ensure the URL is absolute with an explicit scheme: `https://www.arbeitnow.com/api/job-board-api`.","If sourcing the URL from config, validate/normalize it once at load time rather than at every fetch.","Check for accidental whitespace or template-literal interpolation producing an empty scheme."],"exampleFix":"// before — schemeless/relative\nconst FEED_BASE = 'www.arbeitnow.com/api/job-board-api';\n\n// after\nconst FEED_BASE = 'https://www.arbeitnow.com/api/job-board-api';","handlingStrategy":"validation","validationCode":"// Validate the base URL is an absolute https URL before passing it to the provider\nfunction isValidAbsoluteHttpsUrl(u) {\n  try {\n    const p = new URL(u);\n    return p.protocol === 'https:';\n  } catch {\n    return false;\n  }\n}\nif (!isValidAbsoluteHttpsUrl(FEED_BASE)) {\n  throw new Error(`arbeitnow: FEED_BASE is not an absolute https URL: ${FEED_BASE}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep FEED_BASE a hardcoded constant rather than reading it from env.","If the URL must be configurable, validate it once at startup with a shared URL-guard utility.","Never pass user-supplied strings directly into assertArbeitnowUrl."],"tags":["arbeitnow","url-validation","ssrf","config"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}